git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fetch: tag following too ambitious?
@ 2013-10-28 12:42 Michael Haggerty
  2013-10-28 16:34 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Haggerty @ 2013-10-28 12:42 UTC (permalink / raw)
  To: git discussion list

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.

Thoughts?

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fetch: tag following too ambitious?
  2013-10-28 12:42 fetch: tag following too ambitious? Michael Haggerty
@ 2013-10-28 16:34 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2013-10-28 16:34 UTC (permalink / raw)
  To: Michael Haggerty; +Cc: git discussion list

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-28 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-28 12:42 fetch: tag following too ambitious? Michael Haggerty
2013-10-28 16:34 ` Junio C Hamano

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