git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Reimar Döffinger" <Reimar.Doeffinger@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: "git fetch -p" incorrectly deletes branches
Date: Thu, 26 Jan 2017 16:18:34 -0500	[thread overview]
Message-ID: <20170126211834.eplmjcohv3d4zsym@sigill.intra.peff.net> (raw)
In-Reply-To: <20170117060428.nanqz5lr4hi6dum6@reimardoeffinger.de>

On Tue, Jan 17, 2017 at 07:04:28AM +0100, Reimar Döffinger wrote:

> 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

Hmm. It seems like the problem is that "-p" is saying "the other side
does not have refs/heads/test; we must prune it". But I think it is
probably nonsense to apply pruning to a non-wildcard refspec.


> 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.

There is a separate issue of whether it is sane to apply fetch.prune to
a refspec given on the command line; I can imagine it as surprising, to
say the least.

I think "--no-prune" would disable it, though.

-Peff

      reply	other threads:[~2017-01-26 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17  6:04 "git fetch -p" incorrectly deletes branches Reimar Döffinger
2017-01-26 21:18 ` Jeff King [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170126211834.eplmjcohv3d4zsym@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=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.
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 NNTP newsgroup(s).