git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Lightweight tag ?
@ 2009-01-11 18:44 Francis Moreau
  2009-01-11 21:04 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Francis Moreau @ 2009-01-11 18:44 UTC (permalink / raw)
  To: git

Hello,

I'm puzzling about the lightweight.

My problem is that I don't see their point !

They behave the same way like the annotated tags: when pushing to a
repo the lightweight tags are pushed as well, and pulling from a repo
with lightweight tags give the same results (all of this with the
--tags switch).

I would have thought that these kind of tags are local to a
repository but it doesn't look so.

So could anybody give me a useful use case for lightweight tags ?

And how can I create local tags ?

Thanks
-- 
Francis

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

* Re: Lightweight tag ?
  2009-01-11 18:44 Lightweight tag ? Francis Moreau
@ 2009-01-11 21:04 ` Junio C Hamano
  2009-01-12  9:17   ` Francis Moreau
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2009-01-11 21:04 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git

"Francis Moreau" <francis.moro@gmail.com> writes:

> My problem is that I don't see their point !
>
> They behave the same way like the annotated tags: when pushing to a
> repo the lightweight tags are pushed as well, and pulling from a repo
> with lightweight tags give the same results (all of this with the
> --tags switch).

Don't use explicit --tags blindly.  It says "no matter what kind of tag,
transfer everything under refs/tags".  Otherwise you won't see a
difference.

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

* Re: Lightweight tag ?
  2009-01-11 21:04 ` Junio C Hamano
@ 2009-01-12  9:17   ` Francis Moreau
  2009-01-12 12:55     ` Michael J Gruber
  0 siblings, 1 reply; 8+ messages in thread
From: Francis Moreau @ 2009-01-12  9:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hello,

Junio C Hamano <gitster@pobox.com> writes:

> Don't use explicit --tags blindly.  It says "no matter what kind of tag,
> transfer everything under refs/tags".  Otherwise you won't see a
> difference.

Well:

	$ git --version
	git version 1.6.0.4
	$ mkdir test-tag
	$ cd test-tag/
	$ date > A
	$ git init
	Initialized empty Git repository in
	/home/fmoreau/tmp/git/test-tag/.git/
	$ git add .
	$ git commit -a -s -m "Init"
	Created initial commit be8750e: Init
	 1 files changed, 1 insertions(+), 0 deletions(-)
	 create mode 100644 A
	$ cd ..
	$ git clone --bare test-tag test-tag.git
	Initialized empty Git repository in /home/fmoreau/tmp/git/test-tag.git/
	$ cd test-tag
	$ git tag light
	
	$ git tag -a -m "Annoted tag" annoted
	$ git push ../test-tag.git
	Everything up-to-date
	$ git push --tags ../test-tag.git
	Counting objects: 1, done.
	Writing objects: 100% (1/1), 166 bytes, done.
	Total 1 (delta 0), reused 0 (delta 0)
	Unpacking objects: 100% (1/1), done.
	To ../test-tag.git
	 * [new tag]         annoted -> annoted
	 * [new tag]         light -> light

It looks like they're no difference for git-push...

That said the documentation about this is rather cryptic IMHO:

,----[ man git-push ]
| 	--tags
| 	    All refs under $GIT_DIR/refs/tags are pushed, in
| 	    addition to refspecs explicitly listed on the command
| 	    line.
`----

>From a user point of view, the word lightweight is missing here. Why
not simply saying:

,----
| All kind of tags are pushed with this option _otherwise_ only annoted
| tags are pushed
`----

thanks
-- 
Francis

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

* Re: Lightweight tag ?
  2009-01-12  9:17   ` Francis Moreau
@ 2009-01-12 12:55     ` Michael J Gruber
  2009-01-12 13:56       ` Francis Moreau
  0 siblings, 1 reply; 8+ messages in thread
From: Michael J Gruber @ 2009-01-12 12:55 UTC (permalink / raw)
  To: Francis Moreau; +Cc: Junio C Hamano, git

Francis Moreau venit, vidit, dixit 01/12/09 10:17:
> Hello,
> 
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> Don't use explicit --tags blindly.  It says "no matter what kind of tag,
>> transfer everything under refs/tags".  Otherwise you won't see a
>> difference.
> 
> Well:
> 
> 	$ git --version
> 	git version 1.6.0.4
> 	$ mkdir test-tag
> 	$ cd test-tag/
> 	$ date > A
> 	$ git init
> 	Initialized empty Git repository in
> 	/home/fmoreau/tmp/git/test-tag/.git/
> 	$ git add .
> 	$ git commit -a -s -m "Init"
> 	Created initial commit be8750e: Init
> 	 1 files changed, 1 insertions(+), 0 deletions(-)
> 	 create mode 100644 A
> 	$ cd ..
> 	$ git clone --bare test-tag test-tag.git
> 	Initialized empty Git repository in /home/fmoreau/tmp/git/test-tag.git/
> 	$ cd test-tag
> 	$ git tag light
> 	
> 	$ git tag -a -m "Annoted tag" annoted
> 	$ git push ../test-tag.git
> 	Everything up-to-date
> 	$ git push --tags ../test-tag.git
> 	Counting objects: 1, done.
> 	Writing objects: 100% (1/1), 166 bytes, done.
> 	Total 1 (delta 0), reused 0 (delta 0)
> 	Unpacking objects: 100% (1/1), done.
> 	To ../test-tag.git
> 	 * [new tag]         annoted -> annoted
> 	 * [new tag]         light -> light
> 
> It looks like they're no difference for git-push...
> 
> That said the documentation about this is rather cryptic IMHO:
> 
> ,----[ man git-push ]
> | 	--tags
> | 	    All refs under $GIT_DIR/refs/tags are pushed, in
> | 	    addition to refspecs explicitly listed on the command
> | 	    line.
> `----
> 
> From a user point of view, the word lightweight is missing here. Why
> not simply saying:
> 
> ,----
> | All kind of tags are pushed with this option _otherwise_ only annoted
> | tags are pushed
> `----

Your test above confirms that the description is correct and nothing is
missing. "git push" pushes explicitly listed refspecs (or : as a
default). It pushes tags (light and heavy) when asked to.

"git pull" pulls tags if they can be reached from heads which are
pulled. It pulls all tags only when asked to.

In fact, the automatic following of tags (if they can be reached...)
depends on the transport, because typically you want to clone everything
if you clone locally but don't want all tags if you clone/pull from a
remote. There is also a config "tagopt" for overriding this. It's
mentioned but not really explained in "git tag"'s man page.

So, "non-local" tags are the ones which can be reached from heads which
you pull, and local ones are the others. I don't think lightweight tags
are more local than tag objects (please correct me if I'm wrong; I think
this needs more doc). It's just that the latter reside in the object db
store whereas the former are simple refs under refs/tags.

Michael

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

* Re: Lightweight tag ?
  2009-01-12 12:55     ` Michael J Gruber
@ 2009-01-12 13:56       ` Francis Moreau
  2009-01-12 14:54         ` Michael J Gruber
  0 siblings, 1 reply; 8+ messages in thread
From: Francis Moreau @ 2009-01-12 13:56 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Junio C Hamano, git

On Mon, Jan 12, 2009 at 1:55 PM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> Your test above confirms that the description is correct and nothing is
> missing. "git push" pushes explicitly listed refspecs (or : as a
> default). It pushes tags (light and heavy) when asked to.
>

So do you mean that the only way I have for pushing annoted tags only is
to do:

   $ git push origin refs/tags/annoted

That's not what Junio said:

   Don't use explicit --tags blindly.  It says "no matter what kind of tag,
   transfer everything under refs/tags".  Otherwise you won't see a
   difference.

So I interpret this like don't use --tags otherwise lightweight and annoted tags
are the same.

> "git pull" pulls tags if they can be reached from heads which are
> pulled. It pulls all tags only when asked to.
>

[...]

> So, "non-local" tags are the ones which can be reached from heads which
> you pull, and local ones are the others.

So I can't create a local tag on public heads (the ones I'm pushing
out), can I ?

> I don't think lightweight tags are more local than tag objects
> (please correct me if I'm wrong; I think this needs more doc)

Perhaps it needs documents which are more user friendly: I don't know where
the 'lightweight' word is coming from (perhaps from the implementation) but
I would expect that the _local_ term appears in the git-tag manual.

> It's just that the latter reside in the object db
> store whereas the former are simple refs under refs/tags.

That's implementation detail...

I just need to create a local tag where I'm sure it won't be seen by others
whatever the git operations I'm doing, normally a simple "git tag" switch
should be enough...

thanks.
-- 
Francis

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

* Re: Lightweight tag ?
  2009-01-12 13:56       ` Francis Moreau
@ 2009-01-12 14:54         ` Michael J Gruber
  2009-01-12 19:52           ` Junio C Hamano
  2009-01-12 20:50           ` Francis Moreau
  0 siblings, 2 replies; 8+ messages in thread
From: Michael J Gruber @ 2009-01-12 14:54 UTC (permalink / raw)
  To: Francis Moreau; +Cc: Junio C Hamano, git

Francis Moreau venit, vidit, dixit 01/12/09 14:56:
> On Mon, Jan 12, 2009 at 1:55 PM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> Your test above confirms that the description is correct and nothing is
>> missing. "git push" pushes explicitly listed refspecs (or : as a
>> default). It pushes tags (light and heavy) when asked to.
>>
> 
> So do you mean that the only way I have for pushing annoted tags only is
> to do:
> 
>    $ git push origin refs/tags/annoted

You could use the equivalent, more user friendly "git push origin tag
annoted".

> That's not what Junio said:
> 
>    Don't use explicit --tags blindly.  It says "no matter what kind of tag,
>    transfer everything under refs/tags".  Otherwise you won't see a
>    difference.
> 
> So I interpret this like don't use --tags otherwise lightweight and annoted tags
> are the same.

I don't see a difference between lightweight tags and tag objects
regarding the question of automatic tag following, see my parenthetical
request for correction (below) in case I'm wrong.

>> "git pull" pulls tags if they can be reached from heads which are
>> pulled. It pulls all tags only when asked to.
>>
> 
> [...]
> 
>> So, "non-local" tags are the ones which can be reached from heads which
>> you pull, and local ones are the others.
> 
> So I can't create a local tag on public heads (the ones I'm pushing
> out), can I ?
> 
>> I don't think lightweight tags are more local than tag objects
>> (please correct me if I'm wrong; I think this needs more doc)
> 
> Perhaps it needs documents which are more user friendly: I don't know where
> the 'lightweight' word is coming from (perhaps from the implementation) but
> I would expect that the _local_ term appears in the git-tag manual.

It's the other way round. "lightweight" is in the first few lines of the
man, "local" nowhere. In fact I don't see it anywhere in the docs.

>> It's just that the latter reside in the object db
>> store whereas the former are simple refs under refs/tags.
> 
> That's implementation detail...
> 
> I just need to create a local tag where I'm sure it won't be seen by others
> whatever the git operations I'm doing, normally a simple "git tag" switch
> should be enough...

Taking "whatever" literally this is impossible, of course.

Taking it /cum grano salis/ it's still impossible within the same repo:
If others have read access they can "ls-remote" and "fetch" happily what
they want. The sane and easy way is to use a private repo for your local
work and all your "local tags", then to push to a public (i.e.
publically readable) repo those branches and tags which you want to be seen.

Are you a Mercurial user by any chance? "hg tag -l" creates local tags
which are stored in an unversioned, private file, whereas "hg tag"
creates (and commits) a tag entry in a versioned file, which is the
source of some confusion and problems with hg tags ("hg co sometag" does
not contain sometag etc.). Maybe you want the behaviour of "hg tag -l"?

Cheers,
Michael

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

* Re: Lightweight tag ?
  2009-01-12 14:54         ` Michael J Gruber
@ 2009-01-12 19:52           ` Junio C Hamano
  2009-01-12 20:50           ` Francis Moreau
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2009-01-12 19:52 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Francis Moreau, git

Michael J Gruber <git@drmicha.warpmail.net> writes:

>> That's not what Junio said:
>> 
>>    Don't use explicit --tags blindly.  It says "no matter what kind of tag,
>>    transfer everything under refs/tags".  Otherwise you won't see a
>>    difference.
>> 
>> So I interpret this like don't use --tags otherwise lightweight and annoted tags
>> are the same.
>
> I don't see a difference between lightweight tags and tag objects
> regarding the question of automatic tag following, see my parenthetical
> request for correction (below) in case I'm wrong.

It was me who was confused on two points.

 (1) push does not do autofollow and you always have to be explicit
     (including saying "--tags" which is to push all refs/tags/*); I
     somehow thought the question was about fetch;

 (2) if you explicitly ask to fetch tags, there won't be any difference
     (which was my "don't say --tags explicitly because you won't see a
     difference if you did so").

     On the other hand, the autofollowing during the fetch originally
     followed only annotated tags (it was partly by design, so that people
     can use lightweight tags for local stuff without worrying about
     contaminating others' tag namespace with many of them) and I somehow
     thought this was still the case.

     But it is not the case anymore since 6c96c0f (git-fetch: follow
     lightweight tags as well, 2006-11-18).

So, sorry for the noise.

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

* Re: Lightweight tag ?
  2009-01-12 14:54         ` Michael J Gruber
  2009-01-12 19:52           ` Junio C Hamano
@ 2009-01-12 20:50           ` Francis Moreau
  1 sibling, 0 replies; 8+ messages in thread
From: Francis Moreau @ 2009-01-12 20:50 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Junio C Hamano, git

Michael J Gruber <git@drmicha.warpmail.net> writes:

>> Perhaps it needs documents which are more user friendly: I don't know where
>> the 'lightweight' word is coming from (perhaps from the implementation) but
>> I would expect that the _local_ term appears in the git-tag manual.
>
> It's the other way round. "lightweight" is in the first few lines of the
> man, "local" nowhere. In fact I don't see it anywhere in the docs.

Sorry my previous reply wasn't clear, I meant that the word
'lightweight' appears in the man page of git-tag but I don't see why
such term is used, well now I can see but it's implementation detail
so useless (or worth: confusing) for a dumb user (me).

In contrary I would have expected to find the 'local' word if git
support local tags.

>> I just need to create a local tag where I'm sure it won't be seen by others
>> whatever the git operations I'm doing, normally a simple "git tag" switch
>> should be enough...
>
> Taking "whatever" literally this is impossible, of course.
> 
>
> Taking it /cum grano salis/ it's still impossible within the same repo:
> If others have read access they can "ls-remote" and "fetch" happily what
> they want. The sane and easy way is to use a private repo for your local
> work and all your "local tags", then to push to a public (i.e.
> publically readable) repo those branches and tags which you want to be seen.
>

This is how things are currently implemented but if lightweight is
really useless and local tags are somehow missing in Git then I'm
pretty sure it's possible to create such tags that are not seen by
git-{pull,push,fetch] operations.

>
> Are you a Mercurial user by any chance?

Nope.

> "hg tag -l" creates local tags which are stored in an unversioned,
> private file, whereas "hg tag" creates (and commits) a tag entry in
> a versioned file, which is the source of some confusion and problems
> with hg tags ("hg co sometag" does not contain sometag etc.). Maybe
> you want the behaviour of "hg tag -l"?

Yes, It sounds that 'hg tag -l' is what I'm looking for in git...

Thanks
-- 
Francis

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

end of thread, other threads:[~2009-01-12 21:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-11 18:44 Lightweight tag ? Francis Moreau
2009-01-11 21:04 ` Junio C Hamano
2009-01-12  9:17   ` Francis Moreau
2009-01-12 12:55     ` Michael J Gruber
2009-01-12 13:56       ` Francis Moreau
2009-01-12 14:54         ` Michael J Gruber
2009-01-12 19:52           ` Junio C Hamano
2009-01-12 20:50           ` Francis Moreau

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