All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: git discussion list <git@vger.kernel.org>
Subject: Re: fetch: tag following too ambitious?
Date: Mon, 28 Oct 2013 09:34:19 -0700	[thread overview]
Message-ID: <xmqq1u35gxro.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <526E5BBB.6080306@alum.mit.edu> (Michael Haggerty's message of "Mon, 28 Oct 2013 13:42:35 +0100")

Michael Haggerty <mhagger@alum.mit.edu> writes:

> When investigating the exact semantics of tag-following, I discovered
> that the tag auto-following behavior of "git fetch" is more ambitious
> than I would have expected: it fetches any tag that references an object
> that is known to the local repository, *even if that object is not
> currently reachable* (i.e., neither reachable before the fetch or after
> the fetch of non-auto-followed references).  This makes it hard to
> renounce interest in a branch.
>
> Suppose there is a remote repo with
>
>     o---o---o        <- master
>      \
>       o---A---B      <- pu
>
> When I clone this repo, of course I get all of the commits and both
> branches.
>
> Now suppose I decide I'm not interested in "branch" anymore, so I delete
> its remote-tracking branch from my repository and change the config to
> only fetch "master":
>
>     git config remote.origin.fetch \
>             '+refs/heads/master:refs/remotes/origin/master'
>     git update-ref -d refs/remotes/origin/pu
>
> It looks like I'm free of the "pu" branch, right?
>
> But if a week later somebody pushes a tag "t" to origin that points at
> commit A, and then I do
>
>     git fetch origin
>
> then Git (un)helpfully fetches tag "t" into my repo, because even though
> commit "A" isn't reachable in my repo, it hasn't been pruned yet from
> the object database.
>
> I admit this is not likely to be a serious problem in practice, but I
> found it surprising and strangely disturbing.  I would call it a bug.

Sounds like a bug to me.  Does upload-pack to pack-object codepath
actually pack the tag object and give it to you, or is it done all
by reconnecting an existing and dangling tag back to your ref
namespace?

      reply	other threads:[~2013-10-28 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 12:42 fetch: tag following too ambitious? Michael Haggerty
2013-10-28 16:34 ` Junio C Hamano [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=xmqq1u35gxro.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.