Re: [PATCH] git fetch one tag only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cheng renquan <crquan@xxxxxxxxx> writes:

> On Thu, Jun 7, 2012 at 10:08 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>  * The auto-follow kicks in whenever you tell "fetch" to update some
>>   refs locally.  Maybe if we tweak the rule and auto-follow kick in
>>   only when you tell "fetch" to update some refs outside refs/tags
>>   locally,
>>
>>        $ git fetch $over_there tag v1.0.0
>>
>>   will fetch and store _only_ the v1.0.0 tag.
>>
>>   Of course, any behaviour change is a regression, and if done
>>   without an escape hatch, such a change robs people one useful
>>   feature: grab tag v1.0.0 and others older than that tag in one
>>   go.
>>
>> I won't be coding any of the above; just thinking aloud.
>
> Here is the code to implement your 2nd approach,

The patch is obviously and trivially correct ;-)

> and I don't think this behaviour change is a regression,
> because if someone is really relying this fetch one tag actually fetch
> all tags feature
> he is relying on a broken feature,

I do not think the old behaviour is broken. "tag v1.0.0" asks for
refs/tags/v1.0.0 at the remote and store it at refs/tags/v1.0.0
locally.  And when you ask "git fetch" to store something in refs/
hierarchy like that, without --no-tags, you are also asking tags on
commits reachable from v1.0.0 (e.g. v0.99, but not v1.1.0).

	Side note: I just double-checked this.

	$ git init junk && cd junk
        $ git fetch ../git.git tag v1.0.0

	Of course, I get v1.0.0, many tags in v0.99 series and
	v1.0rc tags, but nothing newer.

I would grant you that "asking for only tags v1.0.0 and everything
before" is not a very common thing to do, but I do not think it is a
wrong feature in any way.

In any case, when we discuss regression, "I think the old behaviour
is broken" does not matter.  Change in behaviour is change in
behaviour, even if the new one is superiour than the old one (and I
tend to think that if I were doing Git from scratch, I probably
would have coded the auto-follow part to ignore refs/tags hierarchy).

The problem of introducing such a change _today_ is that it robs a
way to ask for tags v1.0.0 and all tags before it, which people can
do with Git without the patch.  A new --auto-follow-tags option that
undoes what the patch does could remedy it, but without such an
escape hatch, the change will be a true regression as it not just
changes behaviour but it loses capability.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]