From: "Reimar Döffinger" <Reimar.Doeffinger@gmx.de>
To: git@vger.kernel.org
Subject: "git fetch -p" incorrectly deletes branches
Date: Tue, 17 Jan 2017 07:04:28 +0100 [thread overview]
Message-ID: <20170117060428.nanqz5lr4hi6dum6@reimardoeffinger.de> (raw)
Hello!
The command:
git fetch -p -v origin master:refs/heads/test
Deletes refs/heads/test every second time when run repeatedly:
$ git fetch -p -v origin master:refs/heads/test
From https://github.com/git/git
* [new branch] master -> test
= [up to date] master -> origin/master
$ git fetch -p -v origin master:refs/heads/test
From https://github.com/git/git
- [deleted] (none) -> test
= [up to date] master -> test
= [up to date] master -> origin/master
(the command is the result of cutting down the test case,
so yes it is rather silly, but the issue appears in much
less obviously silly cases and causes a lot of confusion)
This is specific to the case of specifying the origin branch
without "full path" AND the right side with.
Wild-guess on cause: "master" is auto-expanded into both
"refs/tags/master" and "refs/heads/master" and instead of
fetching either/merging the result, both are fetched.
Combined with a time-of-check/time-of-use style race condition
on the code that checks if a ref is "up to date" on top of it,
it would result in this behaviour.
Also note that this behaviour appears also when fetch.prune=yes
is set in the config (instead of -p on the command-line),
which makes it much less obvious and there is no option to turn
of prune just for that command to work-around this.
I hope someone has the time to make sure nobody else has to
debug this ever again ;-)
Regards,
Reimar Döffinger
next reply other threads:[~2017-01-17 5:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 6:04 Reimar Döffinger [this message]
2017-01-26 21:18 ` "git fetch -p" incorrectly deletes branches Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170117060428.nanqz5lr4hi6dum6@reimardoeffinger.de \
--to=reimar.doeffinger@gmx.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).