git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Kevin Ballard <kevin@sb.org>, git@vger.kernel.org
Subject: Re: [BUG] git fetch --prune --tags origin deletes all remote branches origin/*
Date: Wed, 25 Aug 2010 22:26:31 -0400	[thread overview]
Message-ID: <AANLkTi=CEBZOK11uyb1SCF8fTc0CyWaEUxMFAv6-=MyB@mail.gmail.com> (raw)
In-Reply-To: <7vsk22ntcl.fsf@alter.siamese.dyndns.org>

On Wed, Aug 25, 2010 at 7:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Kevin Ballard <kevin@sb.org> writes:
>
>> Running the simple command `git fetch --prune --tags origin` will delete
>> every single remote branch refs/remotes/origin/*, with the sole
>> exception of refs/remotes/origin/HEAD. This is wildly unexpected
>> behavior. This was reproduced on the tip of the next branch, with
>> version git version 1.7.2.2.440.g49ea7.
>
> I suspect "--prune --tags" behaved like that from the very beginning of
> the appearance of "--prune",

Indeed. The logic was refactored from "git remote prune" which doesn't
support --tags. The quick fix would be to make --prune --tags and
unsupported combination. However:

> and also it is not limited to --tags.  With
> this:
>
>    [remote "origin"]
>        url = $over_there
>        fetch = refs/heads/master:refs/heads/origin
>        fetch = refs/heads/next:refs/heads/next
>
> "git fetch --prune origin master" would probably remove your local next.

I would think "remote prune" suffered the same fate in that situation.

> get_stale_heads() seems to assume that it has the list of all existing
> refs from the remote side available to make its decision.  Unless the
> fetch is done using a list of refs configured with remote.<name>.fetch, I
> do not think that assumption holds.
>
>  f2ef607 (remote: refactor some logic into get_stale_heads(), 2009-11-10)
>  f360d84 (builtin-fetch: add --prune option, 2009-11-10)

I'm not sure what the best fix here is. It would seem prune should
obey the user's fetch spec.

j.

      reply	other threads:[~2010-08-26  2:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25 22:30 [BUG] git fetch --prune --tags origin deletes all remote branches origin/* Kevin Ballard
2010-08-25 23:52 ` Junio C Hamano
2010-08-26  2:26   ` Jay Soffian [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='AANLkTi=CEBZOK11uyb1SCF8fTc0CyWaEUxMFAv6-=MyB@mail.gmail.com' \
    --to=jaysoffian@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kevin@sb.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).