Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force fetch tags on checkout local working clone #2184

Merged
merged 1 commit into from Jun 26, 2019

Conversation

@hiddeco
Copy link
Member

hiddeco commented Jun 24, 2019

In Git 2.20 "git fetch" was taught to forbid updates to existing tags
without the "--force" option1. As Flux force-pushes a tag all the
time to keep track of the sync state, this would sometimes lead to
'would clobber existing tag' errors while making sure a fresh checkout
was up-to-date with its mirror, as described issue 21692.

To prevent this from happening: force fetch all tags from the mirror
while creating the local working clone, and before fetching anything
else.

NB: We only have to do this while creating a working clone from a
mirror, as a mirror (bare clone) will accept non-fast-forward tag
changes from remote.

Fixes #2169

@hiddeco hiddeco added this to the 1.13.1 milestone Jun 24, 2019
@squaremo

This comment has been minimized.

Copy link
Member

squaremo commented Jun 24, 2019

This makes me nervous because it will apply to all refs fetched from the origin, not just the tag. That makes me think perhaps we should pull the specific tag, with a +, separately to everything else.

@hiddeco

This comment has been minimized.

Copy link
Member Author

hiddeco commented Jun 25, 2019

This makes me nervous because it will apply to all refs fetched from the origin, not just the tag.

This is already the case if I am reading the man page correctly.

Unlike when pushing with git-push(1), any updates
outside of refs/{tags,heads}/* will be accepted
without + in the refspec (or --force), whether
that’s swapping e.g. a tree object for a blob, or a
commit for another commit that’s doesn’t have the
previous commit as an ancestor etc.

@hiddeco hiddeco force-pushed the bug/2169-fix-sync-tag branch from 2fc3a71 to 1605db2 Jun 25, 2019
@squaremo

This comment has been minimized.

Copy link
Member

squaremo commented Jun 25, 2019

any updates outside of refs/{tags,heads}/* will be accepted
without + in the refspec

Since refs/heads/* are branches, that statement does not include branches; i.e., git will only fast-forward branches, when fetching.

@hiddeco hiddeco force-pushed the bug/2169-fix-sync-tag branch 2 times, most recently from b0d0560 to 3a26f73 Jun 25, 2019
@hiddeco hiddeco changed the title Fetch tags with --force due to changes in Git 2.20 Force fetch tags on checkout local working clone Jun 25, 2019
In Git 2.20 "git fetch" was taught to forbid updates to existing tags
without the "--force" option[1]. As Flux force-pushes a tag all the
time to keep track of the sync state, this would sometimes lead to
'would clobber existing tag' errors while making sure a fresh checkout
was up-to-date with its mirror, as described issue 2169[2].

To prevent this from happening: force fetch all tags from the mirror
while creating the local working clone, and _before_ fetching anything
else.

NB: We only have to do this while creating a working clone from a
mirror, as a mirror (bare clone) will accept non-fast-forward tag
changes from remote.

[1]: https://github.com/git/git/blob/master/Documentation/RelNotes/2.20.0.txt#L67-L71
[2]: #2169
@hiddeco hiddeco force-pushed the bug/2169-fix-sync-tag branch from 3a26f73 to 61fdf95 Jun 25, 2019
@hiddeco

This comment has been minimized.

Copy link
Member Author

hiddeco commented Jun 25, 2019

@squaremo this should be it.

Copy link
Member

squaremo left a comment

It's tricky to reproduce the original problem, but I think this does on paper address it.
It also behaves the same as before otherwise, as far as I can tell from actually trying it. So 👍

@hiddeco hiddeco changed the title Force fetch tags on checkout local working clone Force fetch tags on checkout local working clone Jun 26, 2019
@hiddeco hiddeco merged commit 6f55272 into master Jun 26, 2019
3 checks passed
3 checks passed
tag-filter tag-filter
Details
helm-lint helm-lint
Details
ci/circleci: build Your tests passed on CircleCI!
Details
@hiddeco hiddeco deleted the bug/2169-fix-sync-tag branch Jun 26, 2019
squaremo added a commit that referenced this pull request Jun 27, 2019
 Force fetch tags on checkout local working clone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.