Repository navigation
Resolve GitRefSCMHead using its local ref name - #4015
Open
vidhumahajan wants to merge 1 commit into
Open
vidhumahajan wants to merge 1 commit into
vidhumahajan wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AbstractGitSCMSource.retrieve(SCMHead, TaskListener)always returnednullfor aGitRefSCMHead.With
DiscoverOtherRefsTrait("refs/custom/foo")the ref is fetched with+refs/custom/foo:refs/remotes/origin/custom/foo, so in the cache repo it only exists asrefs/remotes/origin/custom/foo.retrieve()calledclient.revParse(mHead.getRef()), which looks uprefs/custom/foo. That name doesn't exist locally, theGitExceptionwas caught andnullcame back, even when the ref existed. Heads found during a scan are created with the remote ref name too, so they had the same problem.I found this while writing the test asked for by the
//TODO write test using GitRefSCMHeadcomment.The fix only touches the
GitRefSCMHeadbranch ofretrieve(): the ref now goes through the configured refspecs, and the first matching one gives the local name (expandFromSource(...).getDestination()). If no refspec matches, the original ref is used as before. The TODO is removed.Testing done
Four new tests in
AbstractGitSCMSourceTest:refs/remotes/origin/custom/fooresolves to the expected commitnull+refs/custom/*:refs/custom/*) still resolvesAll 33 tests in
AbstractGitSCMSourceTestpass locally. I couldn't finish a run of every*SCMSource*test class on my laptop (it ran out of memory), so I'm relying on CI for the rest.