[QUESTION] What is a tag for?

10 messages, 5 authors, 2016-06-15 · open the first message on its own page

[QUESTION] What is a tag for?

From: Alex Bennee <hidden>
Date: 2016-06-15 22:42:16

Hi,

So I want to track Linus's 2.6 git tree as well as do a little small
time hacking. I'm not brave enough to sit on the very bleeding edge and
build what ever happens to be at the "HEAD" of the tree. However when a
kernel releases I'd like to build *that* kernel.

I keep thinking of tags like labels in the old convetional SCM case. Is
this correct? I can see once I've done my update (fetch/cogito what
ever) that these tags apear in my local tree:

22:42 alex@malory [linux-2.6] >cat .git/refs/tags/v2.6.16-rc1
f3bcf72eb85aba88a7bd0a6116dd0b5418590dbe

So what do I do with them now? Are they only for branch points? Is the
only way to know I'm building 2.6.16-rc1 to branch from it as described
in git-branch, even if I'm not planning on doing any development?

Is this part of the concept that branches are cheap and you should feel
free to create and throw them away at will?

I look forward to your elucidation and the ah! moment that finally gets
my head around git ;-)

Cheers,


--
Alex, homepage: http://www.bennee.com/~alex/
Zoe: "So.. Trap?" Mal: "Trap." Zoe: "We goin' in?" Mal: "Ain't nothin'
but a few hours out." Wash: "But, remember the part where it's a trap?"

Re: [QUESTION] What is a tag for?

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:16

  Hi,

Dear diary, on Tue, Jan 17, 2006 at 11:52:24PM CET, I got a letter
where Alex Bennee [off-list ref] said that...
So I want to track Linus's 2.6 git tree as well as do a little small
time hacking. I'm not brave enough to sit on the very bleeding edge and
build what ever happens to be at the "HEAD" of the tree. However when a
kernel releases I'd like to build *that* kernel.

I keep thinking of tags like labels in the old convetional SCM case. Is
this correct? I can see once I've done my update (fetch/cogito what
ever) that these tags apear in my local tree:

22:42 alex@malory [linux-2.6] >cat .git/refs/tags/v2.6.16-rc1
f3bcf72eb85aba88a7bd0a6116dd0b5418590dbe

So what do I do with them now? Are they only for branch points? Is the
only way to know I'm building 2.6.16-rc1 to branch from it as described
in git-branch, even if I'm not planning on doing any development?
  the simplest thing to do in Cogito if you just want to follow tags
around is to cg-fetch periodically (that will get the changes to your
local database, but will not check them out), and cg-seek around to
whatever tag you want:

	$ cg-fetch
	$ cg-seek v2.6.16-rc1
	$ cg-fetch
	... no new tag ...
	$ cg-fetch
	... still no new tag ...
	$ cg-fetch
	... Linus, are you sleeping? ...
	$ cg-fetch
	$ cg-seek v2.6.16-rc2
	...

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe.  -- Douglas Adams

Re: [QUESTION] What is a tag for?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:16

Alex Bennee [off-list ref] writes:
... I'm not brave enough to sit on the very bleeding edge and
build what ever happens to be at the "HEAD" of the tree. However when a
kernel releases I'd like to build *that* kernel.
Then maybe its time to change your e-mail address from
kernel-hacker to kernel-builder? ;-) ;-) ;-)
I keep thinking of tags like labels in the old convetional SCM case. Is
this correct?
Correct.

Tags are just labels.  So you can think of them as a shorthand
that lets you easily communicate a set of selected well-known
versions with others (either people, or git tools).  Instead of
saying 2664b25051f7ab96b22b199aa2f..., you can say v2.6.16-rc1.

All of the things I demonstrate below, you can substitute v2.6.X
with their commit object names and things work the same way.  It
is more convenient and human friendly to use tags.

Except one thing:  signed tags can be verified, if you have GPG
public key of the signer (in this case Linus), with "git
verify-tag".

<offtopic>
Does anybody know where to obtain the public key to verify
v2.6.16-rc1 tag?
</offtopic>
So what do I do with them now? Are they only for branch points?
That is one of the things often done.  To build on top of
v2.6.16-rc1:

	$ git checkout -b myhack v2.6.16-rc1
	$ hack hack hack
        $ git commit -s -m 'Add support for frotz videocard.

	This adds frotz videocard support.  Blah Blah Blah...'

You could also use them to see what happened during a given
timeframe.  For example:

	$ git log v2.6.14..v2.6.15 | git shortlog

would list you all the changes between these two releases, for
example. 

If you know something used to work at a given version, say
v2.6.15, and now it does not work, you can use it as good/bad
input for the bisection bug hunting:

	$ git bisect good v2.6.15 && git bisect bad master
Is the
only way to know I'm building 2.6.16-rc1 to branch from it as described
in git-branch, even if I'm not planning on doing any development?
I do not quite understand.  Immediately after the above example
checkout, before or after doing the hackhack and commit, git
branch would probably say:

	$ git branch
          origin
	  master
        * myhack

Immediately after the example checkout, "git describe myhack"
would answer v2.6.16-rc1.  OTOH, after the hackhack and commit,
it would answer v2.6.16-rc1-gXXXXXXXX where XXXX part is an
abbreviated commit object name of the commit you have at the tip
of myhack branch.

To see what you did in the branch, the tag, if you remember
where you forked from, can be used this way: 

	$ git whatchanged -p v2.6.16-rc1..myhack

However, the above is equivalent to saying this:

	$ git whatchanged -p master..myhack

So in that sense tag is not that useful for the purpose of
getting list of commits (or, more precicely, naming a
development track).

It is useful to name a specific version:

	$ git diff v2.6.16-rc1 myhack

compares two versions; it is not equivalent to "git diff master myhack".
Is this part of the concept that branches are cheap and you should feel
free to create and throw them away at will?
That depends on what you exactly mean by "this", but all of the
above are quite cheap.  If the "myhack" practice turned out to
be useless, you can just:

	$ git checkout master
        $ git branch -D myhack

to come back to the tip of the mainline and delete your side branch.

Re: [QUESTION] What is a tag for?

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:16


On Tue, 17 Jan 2006, Junio C Hamano wrote:
<offtopic>
Does anybody know where to obtain the public key to verify
v2.6.16-rc1 tag?
</offtopic>
Do a google search for "torvalds" and "tag signing key", and you'll find 
the thread that has the original key in it.

In fact, if you search for "torvalds" "tag" and "BEGIN PGP PUBLIC KEY 
BLOCK", it will be the first hit.

Anyway, here it is again. Linus' tag signing key. I could do what you do, 
but I feel that it's kind of pointless to put the public key with the 
project, since if you don't trust the project, you shouldn't trust the key 
it contains as being from me.

You fundamentally want to have some _other_ reason to trust the key, like 
the fact that you can find it independently with google ;)

		Linus

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.1 (GNU/Linux)

mQGiBEJqZ4sRBADKttqQOCAxRzz5qGmo5QnSR5GTkSlPTm4lCuaVUon0qQPNrasr
cSBAOJ1MlXjhbRPrN3pA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GwwACgkQ
F3YsRnbiHLsolQCfRVImDkgijhPGmwyI7T19bWltXwsAniMi9gakkN+9DT8E5kli
e8uTEk8f
=PRrZ
-----END PGP PUBLIC KEY BLOCK-----

Re: [QUESTION] What is a tag for?

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:16

Dear diary, on Wed, Jan 18, 2006 at 02:41:27AM CET, I got a letter
where Junio C Hamano [off-list ref] said that...
Alex Bennee [off-list ref] writes:
quoted
Is the
only way to know I'm building 2.6.16-rc1 to branch from it as described
in git-branch, even if I'm not planning on doing any development?
I do not quite understand.  Immediately after the above example
checkout, before or after doing the hackhack and commit, git
branch would probably say:

	$ git branch
          origin
	  master
        * myhack
Well if I understand it, at this point he would just periodically fetch
and get the tags, and when a new release appears, he would merge it to
myhack, and so on. Which is probably the only way if you don't have
cg-seek (I thought git checkout could do it, but it doesn't seem to be
the case), but I can see no advantage of doing it if you can just
cg-seek (unless, after all, you do want to do some development). But
just in case, with Cogito that would be:

	$ cg-switch -r v2.6.16-rc1 myhack
	# You need Cogito-0.17.GIT for this. It is equivalent to git
	# branch, I think.
	$ cg-fetch
	$ cg-fetch
	$ cg-fetch
	$ cg-merge v2.6.16-rc2
	$ cg-fetch
	$ cg-merge v2.6.16
	...

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe.  -- Douglas Adams

Re: [QUESTION] What is a tag for?

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:42:16

Alex Bennee wrote:
Hi,

So I want to track Linus's 2.6 git tree as well as do a little small
time hacking. I'm not brave enough to sit on the very bleeding edge and
build what ever happens to be at the "HEAD" of the tree. However when a
kernel releases I'd like to build *that* kernel.

I keep thinking of tags like labels in the old convetional SCM case. Is
this correct? I can see once I've done my update (fetch/cogito what
ever) that these tags apear in my local tree:
I'm not sure if you got the answer you wanted from Junio or Petr, so I 
thought I'd add my own explanation to this as well. If nothing else it 
might be useful for someone greping through the archives.

There are three types of tags: simple, annotated and signed+annotated. 
All tags work just as a branch head, except that you can't do 'git 
checkout' on it (i.e. it's a pointer to a particular commit, but lives 
in $GIT_DIR/refs/tags instead of  $GIT_DIR/refs/heads).

Simple, or unannotated, tags are useful for creating anchor points so 
that you can jump to a particular state of development that's useful for 
you as a developer to know about (I for one think sha-hashes are a tad 
hard to remember). You could just as easily create a branch for doing 
this, but that's not always practical. F.e. when you're resetting or 
rebasing the current branch or doing some other of gits more voodoo-ish 
things. If you do

	$ git cat-file -t <tagname>

on a simple tag it'll tell you it's a "commit" object, because that's 
the type of the object it points to in the object database.

If you do the same on an annotated tag, whether it's signed or not, "git 
cat-file -t <tagname>" will tell you it's a 'tag' object.

A tag object has a reference to a commit-object and some additional data 
inside it. Try

	$ git cat-file tag v1.0.0

in the current git-repo and you'll see the following output
----8<---8<---8<----
object c2f3bf071ee90b01f2d629921bb04c4f798f02fa
type commit
tag v1.0.0
tagger Junio C Hamano [off-list ref] 1135152060 -0800

GIT 1.0.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBDqOh7wMbZpPMRm5oRAg+OAJ90pNi/fq5rguVou1PSxx95PYCVeACfbnZM
nN/PlwOWKA3rW8EPmWO4BzE=
=TCRg
-----END PGP SIGNATURE-----
----8<----8<----8<----


'object' at the first line is the commit the tag points to. The rest 
should be fairly self-evident.

After the empty line there follows a message that the tagger can enter 
when typing the tag. This can be fairly useful if you wish to make it 
so. I use it to write a gisted changelog, listing new features and fixed 
bugs in a few words. All annotated tags that gets pushed to our shared 
repos are automatically, through the 'update' hook, sent by email to our 
sales and marketing people. I like that, since I only have to use one 
tool for hacking, reporting, logging history and everything else that's 
real developer work. It also means I never forget sending feature 
updates to the suits, so they pester me less and life is a bit sweeter.

A signed annotated tag requires that you have a valid gpg key. The tag 
shown above is signed using gpg (the only way of signing supported, I 
think).

So, in essence;
* A simple, or unannotated tag just points to a commit object and has no 
message attached to it.
* An annotated tag points to a tag object and has a message of arbitrary 
length attached to it. The tag object points to a commit object.
* Only annotated tags can be signed.


I'd recommend not allowing un-annotated tags in your shared repo. I sent 
a patch for the default update-hook sometime ago that disallows this. 
Junio seemed happy about it so I don't understand why it hasn't been 
pushed to the master branch yet.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Re: [QUESTION] What is a tag for?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:16

Andreas Ericsson [off-list ref] writes:
I'd recommend not allowing un-annotated tags in your shared repo. I
sent a patch for the default update-hook sometime ago that disallows
this. Junio seemed happy about it so I don't understand why it hasn't
been pushed to the master branch yet.
Most likely lost in the noise.  I probably have it in my mailbox
but not applied in any of my private branches in my repository.

Re: [QUESTION] What is a tag for?

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:42:16

Junio C Hamano wrote:
Andreas Ericsson [off-list ref] writes:

quoted
I'd recommend not allowing un-annotated tags in your shared repo. I
sent a patch for the default update-hook sometime ago that disallows
this. Junio seemed happy about it so I don't understand why it hasn't
been pushed to the master branch yet.

Most likely lost in the noise.  I probably have it in my mailbox
but not applied in any of my private branches in my repository.
I'll apply (and test) Linus suggestions of new refs and re-send it when 
I'm done watching King-Kong and stuffing my face with popcorn.

-
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Re: [QUESTION] What is a tag for?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:17

Andreas Ericsson [off-list ref] writes:
I'll apply (and test) Linus suggestions of new refs and re-send it
when I'm done watching King-Kong and stuffing my face with popcorn.
It appears you have not finished watching the movie yet, so I
took the liberty of adding this on top of your patch myself
;-).

Re: [QUESTION] What is a tag for?

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:42:17

Junio C Hamano wrote:
Andreas Ericsson [off-list ref] writes:

quoted
I'll apply (and test) Linus suggestions of new refs and re-send it
when I'm done watching King-Kong and stuffing my face with popcorn.

It appears you have not finished watching the movie yet, so I
took the liberty of adding this on top of your patch myself
;-).
Sorry about that. I started adding stuff to it to disallow creating 
branches that have no unique commits, and then thought of some other fun 
stuff that's a bit specific to the place I work so I never got around to it.

Somehow the phb's never grow tired of coming up with new ways to waste 
my time just when I've found a way to save some, forcing me to find a 
way to find some more. Anyways, if anybody wants an update-hook to 
update a project-management tool with worked time, gimme a holler. It's 
quite neat but completely flawed in a good way. :)

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help