Re: any way to apply tag across all branches in repository?

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

 




On Tue, 19 May 2009, Chris Friesen wrote:
> 
> This is all in the same local repository, but with target-specific branches
> containing arch-specific changes on top of a common codebase.  The
> arch-specific stuff often comes from board vendors and such, and they're
> never going to be merged back into the common codebase.
> 
> I'm looking for some way to conceptually tag the current head of each
> branch to indicate "this commit was used to build product version FOO" so
> that later on when we find a bug in our code we can tell which product
> version(s) contain the bug and need to be patched in the field.

Oh. Yes, in that case, you do need to just tag each head.

> The brute-force way to do this would be to manually loop through each branch
> and create a tag of the form "$branch_$version" to ensure unique tags.  But I was
> hoping there was a more elegant way.

Well, I would suggest that you do it fundamentally differently.

Instead of tagging each build, I would suggest just associating each build 
with the commit SHA1 of the time. That's what Linux does (if you enable 
CONFIG_LOCALVERSION_AUTO), and it's _way_ superior to lots of crazy tags.

So for example, I can do

	[torvalds@nehalem ~]$ uname -r
	2.6.30-rc6-00302-g72357d5-dirty

and it tells me exactly what kernel version I'm running (well, the "dirty"
part means that it's not exact and has some additional patches that 
weren't committed, but that's as close as you can get). It's very useful.

Now, with some other build, you might want to just encode the SHA1 
revision in your binary. For example, a simple build-time rule like a 
Makefile addition that does something like

   version.c:
	echo 'const char git_build_version = "'$(git describe)'";" > version.c

and then you just force version.o to be linked into your build.

Trust me, something like the above is _much_ better than tagging each 
branchthat you build. Partly because it means that you can do the builds 
in a distributed manner, and they'll all get the version built in, rather 
than having to rely on everybody tagging everything and then trying to 
match up the tag to some random binary.

			Linus
--
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]