fix(check): scope FETCH_HEAD reset to single-branch fetch path#471
Open
tripleawwy wants to merge 1 commit intoconcourse:masterfrom
Open
fix(check): scope FETCH_HEAD reset to single-branch fetch path#471tripleawwy wants to merge 1 commit intoconcourse:masterfrom
tripleawwy wants to merge 1 commit intoconcourse:masterfrom
Conversation
The `git reset --soft FETCH_HEAD` was introduced in commit 1a71141 for single-branch fetches where FETCH_HEAD has exactly one entry. PR concourse#461 changed the fetch to multi-branch when tag filtering is enabled, but did not update the reset. With multiple branches in FETCH_HEAD, the reset picks the first entry (alphabetically), which is typically not the tracked branch. This corrupts refs/heads/<branch> and causes `git tag --merged <branch>` to resolve to the wrong commit, silently missing tags. Move the reset into the else (single-branch) path where it is needed. The tags-case fetch with refs/heads/*:refs/heads/* already updates refs/heads/* directly via the refspec, making the reset redundant. Fixes concourse#470
|
|
nothing easy in EasyCLA ... |
Member
|
Just read the issue. Thanks for the detailed write up @tripleawwy. I'll dig into this more and review the PR. Do you have any issues with the EasyCLA check? Pretty sure you can make an account using GitHub as the IDP and then it'll pass. |
|
Hi, and is there no way that a simple |
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.
Fixes #470
Problem
PR #461 (fixing #448) changed the fetch to multi-branch when tag filtering is enabled, but the existing
git reset --soft FETCH_HEADon the next line now picks up the wrong branch. With multiple branches inFETCH_HEAD, the reset takes the first entry (alphabetically sorted), which is typically not the tracked branch. This corruptsrefs/heads/<branch>and causes--merged <branch>in the tag discovery to resolve to the wrong commit, silently missing tags.Fix
Move
git reset --soft FETCH_HEADinto theelse(single-branch) path where it was originally designed to run (commit 1a71141). The tags-case fetch withrefs/heads/*:refs/heads/*already updatesrefs/heads/*directly via the refspec, making the reset redundant in that path.Reproduction
See #470 for a full reproduction script and detailed analysis.