{"thread":{"id":"19417","subject":"any way to apply tag across all branches in repository?","startedAt":"2009-05-19T16:26:33Z","lastAt":"2009-05-19T21:31:18Z","messageCount":16,"participants":["Chris Friesen","Tomas Carnecky","Brandon Casey","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"114281","messageId":"4A12DDB9.60608@nortel.com","threadId":"19417","inReplyTo":null,"subject":"any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T16:26:33Z","receivedAt":"2009-05-19T16:26:33Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"\nHi all,\n\nI'm hoping you can help me out...please CC me on replies, I'm not\nsubscribed to the list.\n\nWe have a piece of software with a \"main\" branch and multiple\narchitecture-specific \"target\" branches.  At each \"official\" compile,\nwe'd like to tag the commits that went into that compile with an identifier.\n\nUsing tags normally requires that the tag be assigned to each branch\nindividually--is there any way to apply some sort of designator to the\nhead of each branch in the repository all at once rather than doing it\nseparately for each branch?\n\nThanks,\n\nChris\n"},{"id":"114285","messageId":"F3E3C849-76E1-4D5F-8305-276C4C205250@dbservice.com","threadId":"19417","inReplyTo":"4A12DDB9.60608@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2009-05-19T16:52:20Z","receivedAt":"2009-05-19T16:52:20Z","isPatch":false,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"\nOn May 19, 2009, at 6:26 PM, Chris Friesen wrote:\n\n>\n> Hi all,\n>\n> I'm hoping you can help me out...please CC me on replies, I'm not\n> subscribed to the list.\n>\n> We have a piece of software with a \"main\" branch and multiple\n> architecture-specific \"target\" branches.  At each \"official\" compile,\n> we'd like to tag the commits that went into that compile with an  \n> identifier.\n>\n> Using tags normally requires that the tag be assigned to each branch\n> individually--is there any way to apply some sort of designator to the\n> head of each branch in the repository all at once rather than doing it\n> separately for each branch?\n\nTags are not specific to any branch in particular. Usually you tag  \ncommits, and git doesn't care on which branch these commits are. That  \ninformation is not recorded in the tag.\n\nWhat you can do is create an alias that iterates over all branches and  \ntags each one.\n\ngit for-each-ref refs/heads/main refs/heads/arch/ | while read sha  \ntype ref; do\n     git tag TAGNAME $sha -m \"Tagged $ref\"\ndone\n\n$sha is the sha where the ref points to, $type will be 'commit' and  \n$ref is the full ref (refs/heads/arch/xxx for example)\n\ntom\n"},{"id":"114286","messageId":"4A12E586.60705@nortel.com","threadId":"19417","inReplyTo":"F3E3C849-76E1-4D5F-8305-276C4C205250@dbservice.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T16:59:50Z","receivedAt":"2009-05-19T16:59:50Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"Tomas Carnecky wrote:\n\n> Tags are not specific to any branch in particular. Usually you tag  \n> commits, and git doesn't care on which branch these commits are. That  \n> information is not recorded in the tag.\n> \n> What you can do is create an alias that iterates over all branches and  \n> tags each one.\n> \n> git for-each-ref refs/heads/main refs/heads/arch/ | while read sha  \n> type ref; do\n>      git tag TAGNAME $sha -m \"Tagged $ref\"\n> done\n> \n> $sha is the sha where the ref points to, $type will be 'commit' and  \n> $ref is the full ref (refs/heads/arch/xxx for example)\n\nI tried something like this manually but on the second branch it complained\nthat the tag already existed.\n\nChris\n"},{"id":"114288","messageId":"Y0WmOpNg_9ptwbJ3VHYrzAgFtDvPi5pn4Tz-0w5Phhlo9frjieUaeA@cipher.nrlssc.navy.mil","threadId":"19417","inReplyTo":"4A12DDB9.60608@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-19T17:05:29Z","receivedAt":"2009-05-19T17:05:29Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Chris Friesen wrote:\n> Hi all,\n> \n> I'm hoping you can help me out...please CC me on replies, I'm not\n> subscribed to the list.\n> \n> We have a piece of software with a \"main\" branch and multiple\n> architecture-specific \"target\" branches.  At each \"official\" compile,\n> we'd like to tag the commits that went into that compile with an identifier.\n> \n> Using tags normally requires that the tag be assigned to each branch\n> individually--is there any way to apply some sort of designator to the\n> head of each branch in the repository all at once rather than doing it\n> separately for each branch?\n\nIf I understand you correctly, you are doing your primary development on\nthe \"main\" branch and then merging this into the architecture specific\nbranches which contain additional architecture specific changes.\n\nAll you need to do is tag the \"main\" branch.  Actually, you are tagging\nthe commit that the branch currently points at.  When this branch is\nmerged into the other branches, they will also contain this commit, and\n'git describe' will use the tag you created when generating the version\nstring.\n\n-brandon\n"},{"id":"114291","messageId":"4A12F0ED.4070707@nortel.com","threadId":"19417","inReplyTo":"Y0WmOpNg_9ptwbJ3VHYrzAgFtDvPi5pn4Tz-0w5Phhlo9frjieUaeA@cipher.nrlssc.navy.mil","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T17:48:29Z","receivedAt":"2009-05-19T17:48:29Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"Brandon Casey wrote:\n\n> If I understand you correctly, you are doing your primary development on\n> the \"main\" branch and then merging this into the architecture specific\n> branches which contain additional architecture specific changes.\n\nCorrect.\n\n> All you need to do is tag the \"main\" branch.  Actually, you are tagging\n> the commit that the branch currently points at.  When this branch is\n> merged into the other branches, they will also contain this commit, and\n> 'git describe' will use the tag you created when generating the version\n> string.\n\nI think this would work if the most recent commit is on the main branch.\n\nHowever, if I make a change on the arch-specific branch, then tag the\nmain branch and merge it into the arch-specific branch, git tells me\nthe arch-specific branch is already up-to-date and the tag doesn't\nget propagated.\n\nChris\n"},{"id":"114292","messageId":"alpine.LFD.2.01.0905191132490.3301@localhost.localdomain","threadId":"19417","inReplyTo":"4A12F0ED.4070707@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-05-19T18:33:58Z","receivedAt":"2009-05-19T18:33:58Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 19 May 2009, Chris Friesen wrote:\n> \n> However, if I make a change on the arch-specific branch, then tag the\n> main branch and merge it into the arch-specific branch, git tells me\n> the arch-specific branch is already up-to-date and the tag doesn't\n> get propagated.\n\nYou can always just do \"git fetch --tags\" to fetch any new tags without \ndoing anything else.\n\n\t\t\tLinus\n"},{"id":"114293","messageId":"NFLo0xGp2o-oBdtr_pq1jvwATe1ZALaD9dHkr5hmKNkU30gr_isMpQ@cipher.nrlssc.navy.mil","threadId":"19417","inReplyTo":"4A12F0ED.4070707@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-19T18:36:46Z","receivedAt":"2009-05-19T18:36:46Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Chris Friesen wrote:\n> Brandon Casey wrote:\n> \n>> If I understand you correctly, you are doing your primary development on\n>> the \"main\" branch and then merging this into the architecture specific\n>> branches which contain additional architecture specific changes.\n> \n> Correct.\n> \n>> All you need to do is tag the \"main\" branch.  Actually, you are tagging\n>> the commit that the branch currently points at.  When this branch is\n>> merged into the other branches, they will also contain this commit, and\n>> 'git describe' will use the tag you created when generating the version\n>> string.\n> \n> I think this would work if the most recent commit is on the main branch.\n> \n> However, if I make a change on the arch-specific branch, then tag the\n> main branch and merge it into the arch-specific branch, git tells me\n> the arch-specific branch is already up-to-date and the tag doesn't\n> get propagated.\n\nTags aren't versioned.  They exist outside of the branch namespace.\nSo merging doesn't have any direct effect on tags.  It is the _commits_\nthat are merged in (which the tags point to).  If you have already\nmerged the main branch into the arch-specific branch, then there is\nnothing else for git to do.  Your repository looks something like this\ngraph:\n\n    --o--o---o---o---o---o--o   \"arch\"\n     /                  /\n   -o--o---o---o---o---o        \"main\"\n                       |\n                      my_tag\n\nWhen you merge \"main\" into \"arch\", the \"main\" DAG* becomes a part of the\n\"arch\" DAG.  The tag points to a specific commit, which represents a state\nof the DAG, which is also now part of the \"arch\" DAG.\n\nThe output of 'git describe $arch_branch' will likely change after you\ncreate the tag though.\n\nTry these commands:\n\n  git describe $main\n  git describe $arch_branch\n  git tag -m 'a test tag' my_tag $main\n  git describe $main\n  git describe $arch_branch\n\n-brandon\n\n* DAG - directed acyclic graph\n"},{"id":"114295","messageId":"4A130309.2060407@nortel.com","threadId":"19417","inReplyTo":"NFLo0xGp2o-oBdtr_pq1jvwATe1ZALaD9dHkr5hmKNkU30gr_isMpQ@cipher.nrlssc.navy.mil","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T19:05:45Z","receivedAt":"2009-05-19T19:05:45Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"Brandon Casey wrote:\n\n> Try these commands:\n> \n>   git describe $main\n>   git describe $arch_branch\n>   git tag -m 'a test tag' my_tag $main\n>   git describe $main\n>   git describe $arch_branch\n\nIn the commands below, \"main\" is $main, and \"arch\" is $arch_branch.\nI'm starting out with the arch branch checked out.\n\n[cfriesen@localhost linux]$ git describe main\ndynamic_ftrace_excluded-auto-mark-225-g7c2dc32\n[cfriesen@localhost linux]$ git describe arch\ndynamic_ftrace_excluded-auto-mark-225-g7c2dc32\n[cfriesen@localhost linux]$ git tag -m 'a test tag' my_tag ncgl\n[cfriesen@localhost linux]$ git describe arch\nmy_tag\n[cfriesen@localhost linux]$ git describe arch\nmy_tag\n\nSo far so good.  Now I make a change to the arch branch, and add\nanother tag to the main branch.\n\n[cfriesen@localhost linux]$ echo a > asdf\n[cfriesen@localhost linux]$ git add asdf\n[cfriesen@localhost linux]$ git commit\nCreated commit 4c8dfa7: blah\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 asdf\n\n[cfriesen@localhost linux]$ git describe main\nmy_tag\n[cfriesen@localhost linux]$ git describe arch\nmy_tag-1-g4c8dfa7\n\n\nNow we add another tag to the main branch:\n\n[cfriesen@localhost linux]$ git tag -m 'a test tag' my_tag2 main\n[cfriesen@localhost linux]$ git describe main\nmy_tag\n[cfriesen@localhost linux]$ git describe arch\nmy_tag-1-g4c8dfa7\n\nI assume that since there were no code changes on the main branch,\nit doesn't think that there is any difference between the two tags.\n\nChris\n"},{"id":"114296","messageId":"4A13030D.8000000@nortel.com","threadId":"19417","inReplyTo":"alpine.LFD.2.01.0905191132490.3301@localhost.localdomain","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T19:05:49Z","receivedAt":"2009-05-19T19:05:49Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"Linus Torvalds wrote:\n> \n> On Tue, 19 May 2009, Chris Friesen wrote:\n>> However, if I make a change on the arch-specific branch, then tag the\n>> main branch and merge it into the arch-specific branch, git tells me\n>> the arch-specific branch is already up-to-date and the tag doesn't\n>> get propagated.\n> \n> You can always just do \"git fetch --tags\" to fetch any new tags without \n> doing anything else.\n\nThis is all in the same local repository, but with target-specific branches\ncontaining arch-specific changes on top of a common codebase.  The\narch-specific stuff often comes from board vendors and such, and they're\nnever going to be merged back into the common codebase.\n\nI'm looking for some way to conceptually tag the current head of each\nbranch to indicate \"this commit was used to build product version FOO\" so\nthat later on when we find a bug in our code we can tell which product\nversion(s) contain the bug and need to be patched in the field.\n\nThe brute-force way to do this would be to manually loop through each branch\nand create a tag of the form \"$branch_$version\" to ensure unique tags.  But I was\nhoping there was a more elegant way.\n\nChris\n"},{"id":"114297","messageId":"0WGSJO_TdUxCKWhDCupb3MaPOyPeVNH7Rs_7iKVnQcahmxUpwu8qzw@cipher.nrlssc.navy.mil","threadId":"19417","inReplyTo":"4A130309.2060407@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-19T19:30:30Z","receivedAt":"2009-05-19T19:30:30Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Chris Friesen wrote:\n> Brandon Casey wrote:\n> \n>> Try these commands:\n>>\n>>   git describe $main\n>>   git describe $arch_branch\n>>   git tag -m 'a test tag' my_tag $main\n>>   git describe $main\n>>   git describe $arch_branch\n> \n> In the commands below, \"main\" is $main, and \"arch\" is $arch_branch.\n> I'm starting out with the arch branch checked out.\n> \n> [cfriesen@localhost linux]$ git describe main\n> dynamic_ftrace_excluded-auto-mark-225-g7c2dc32\n> [cfriesen@localhost linux]$ git describe arch\n> dynamic_ftrace_excluded-auto-mark-225-g7c2dc32\n> [cfriesen@localhost linux]$ git tag -m 'a test tag' my_tag ncgl\n\nWhat's \"ncgl\"?  Another branch at the same tip as \"arch\"?\n\n> [cfriesen@localhost linux]$ git describe arch\n> my_tag\n> [cfriesen@localhost linux]$ git describe arch\n> my_tag\n\nWas one of those supposed to be \"main\"?\n\n> So far so good.\n\nI expected to see:\n\n  $ git tag -m 'a test tag' my_tag main\n\n  $ git describe main\n  my_tag\n\n  $ git describe arch\n  my_tag-X-g0123456\n\nWhere 'X' is some number equal to the number of commits _not_ reachable\nfrom \"my_tag\", and the digits after the 'g' are an abbreviated sha1 of\nthe tip commit on the arch branch.\n\n> Now I make a change to the arch branch, and add\n> another tag to the main branch.\n> \n> [cfriesen@localhost linux]$ echo a > asdf\n> [cfriesen@localhost linux]$ git add asdf\n> [cfriesen@localhost linux]$ git commit\n> Created commit 4c8dfa7: blah\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>  create mode 100644 asdf\n> \n> [cfriesen@localhost linux]$ git describe main\n> my_tag\n> [cfriesen@localhost linux]$ git describe arch\n> my_tag-1-g4c8dfa7\n\nOk, so maybe this is a test repo.  I didn't expect main and arch\nto ever point to the exact same state.  This won't happen in\nyour real repo unless you are merging arch back into main.\n\nOk, you tagged main, and previously arch was at the same state,\nso 'git describe' printed out 'my_tag' for both of them.  Now,\nthe arch branch is ahead of main by one commit, so you get an\nexpanded string from 'git describe' (the meaning of which I\ndescribed earlier, above).\n\n> Now we add another tag to the main branch:\n> \n> [cfriesen@localhost linux]$ git tag -m 'a test tag' my_tag2 main\n> [cfriesen@localhost linux]$ git describe main\n> my_tag\n> [cfriesen@localhost linux]$ git describe arch\n> my_tag-1-g4c8dfa7\n> \n> I assume that since there were no code changes on the main branch,\n> it doesn't think that there is any difference between the two tags.\n\nRight.  There is no difference.  You created another tag pointing at\nthe same revision as the first tag.  Here's something else to try:\n\n   $ git rev-parse main\n   $ git rev-parse my_tag\n   $ git rev-parse my_tag2\n\nYou'll see that they all print out the same sha1 string.\n\nYou can also try this:\n\n   $ git rev-parse arch^\n   # prints out same sha1 as above\n\n   $ git rev-parse arch\n   # prints out the sha1 of the commit that you just created\n\nOff-hand, I'm not sure how 'git describe' decides which tag to use\nin the describe output when there is more than one candidate.\nPossibly earliest created?, possible alphabetical?  I didn't look.\n\nStarting to make sense?\n\n-brandon\n"},{"id":"114298","messageId":"4A130D45.1050207@nortel.com","threadId":"19417","inReplyTo":"0WGSJO_TdUxCKWhDCupb3MaPOyPeVNH7Rs_7iKVnQcahmxUpwu8qzw@cipher.nrlssc.navy.mil","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T19:49:25Z","receivedAt":"2009-05-19T19:49:25Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"Brandon Casey wrote:\n> Chris Friesen wrote:\n\n>> [cfriesen@localhost linux]$ git tag -m 'a test tag' my_tag ncgl\n> \n> What's \"ncgl\"?  Another branch at the same tip as \"arch\"?\n\nOops, missed a replace.  \"ncgl\" is my main branch.\n\n> Ok, you tagged main, and previously arch was at the same state,\n> so 'git describe' printed out 'my_tag' for both of them.  Now,\n> the arch branch is ahead of main by one commit, so you get an\n> expanded string from 'git describe' (the meaning of which I\n> described earlier, above).\n> \n>> Now we add another tag to the main branch:\n>>\n>> [cfriesen@localhost linux]$ git tag -m 'a test tag' my_tag2 main\n>> [cfriesen@localhost linux]$ git describe main\n>> my_tag\n>> [cfriesen@localhost linux]$ git describe arch\n>> my_tag-1-g4c8dfa7\n>>\n>> I assume that since there were no code changes on the main branch,\n>> it doesn't think that there is any difference between the two tags.\n> \n> Right.  There is no difference.  You created another tag pointing at\n> the same revision as the first tag.  Here's something else to try:\n\n<snip>\n\n> Starting to make sense?\n\nYep.  I still need whatever identifier I use to be associated with the\nhead of each branch.\n\nBased on the discussion (thanks for the explanations, by the way) I\ndon't see any option other than looping through each branch and using\ntags with the branch name embedded in them to ensure uniqueness across\nthe repository.\n\nChris\n"},{"id":"114299","messageId":"ZSs3H_GRUGTI_yYwSwXULjkMD8YR-hSkoePTFq0NfYvkbDV9N7CgMw@cipher.nrlssc.navy.mil","threadId":"19417","inReplyTo":"4A130D45.1050207@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-19T19:58:01Z","receivedAt":"2009-05-19T19:58:01Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Chris Friesen wrote:\n> Brandon Casey wrote:\n\n> <snip>\n> \n>> Starting to make sense?\n> \n> Yep.  I still need whatever identifier I use to be associated with the\n> head of each branch.\n> \n> Based on the discussion (thanks for the explanations, by the way) I\n> don't see any option other than looping through each branch and using\n> tags with the branch name embedded in them to ensure uniqueness across\n> the repository.\n\nBased on this, and your other message, it sounds like you want to have a\ntag named 'v1.2.3' which is treated differently for each branch.  Since\nthere is only a single tag namespace, this is not possible.  Tag names\nmust be unique.\n\nYou can also use slashes in tag names.  Perhaps you could have the illusion\nof common version numbers by using tag names like $arch/$version?\n\n-brandon\n"},{"id":"114301","messageId":"alpine.LFD.2.01.0905191307320.3301@localhost.localdomain","threadId":"19417","inReplyTo":"4A13030D.8000000@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-05-19T20:14:22Z","receivedAt":"2009-05-19T20:14:22Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 19 May 2009, Chris Friesen wrote:\n> \n> This is all in the same local repository, but with target-specific branches\n> containing arch-specific changes on top of a common codebase.  The\n> arch-specific stuff often comes from board vendors and such, and they're\n> never going to be merged back into the common codebase.\n> \n> I'm looking for some way to conceptually tag the current head of each\n> branch to indicate \"this commit was used to build product version FOO\" so\n> that later on when we find a bug in our code we can tell which product\n> version(s) contain the bug and need to be patched in the field.\n\nOh. Yes, in that case, you do need to just tag each head.\n\n> The brute-force way to do this would be to manually loop through each branch\n> and create a tag of the form \"$branch_$version\" to ensure unique tags.  But I was\n> hoping there was a more elegant way.\n\nWell, I would suggest that you do it fundamentally differently.\n\nInstead of tagging each build, I would suggest just associating each build \nwith the commit SHA1 of the time. That's what Linux does (if you enable \nCONFIG_LOCALVERSION_AUTO), and it's _way_ superior to lots of crazy tags.\n\nSo for example, I can do\n\n\t[torvalds@nehalem ~]$ uname -r\n\t2.6.30-rc6-00302-g72357d5-dirty\n\nand it tells me exactly what kernel version I'm running (well, the \"dirty\"\npart means that it's not exact and has some additional patches that \nweren't committed, but that's as close as you can get). It's very useful.\n\nNow, with some other build, you might want to just encode the SHA1 \nrevision in your binary. For example, a simple build-time rule like a \nMakefile addition that does something like\n\n   version.c:\n\techo 'const char git_build_version = \"'$(git describe)'\";\" > version.c\n\nand then you just force version.o to be linked into your build.\n\nTrust me, something like the above is _much_ better than tagging each \nbranchthat you build. Partly because it means that you can do the builds \nin a distributed manner, and they'll all get the version built in, rather \nthan having to rely on everybody tagging everything and then trying to \nmatch up the tag to some random binary.\n\n\t\t\tLinus\n"},{"id":"114304","messageId":"4A131D16.1030001@nortel.com","threadId":"19417","inReplyTo":"alpine.LFD.2.01.0905191307320.3301@localhost.localdomain","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T20:56:54Z","receivedAt":"2009-05-19T20:56:54Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"Linus Torvalds wrote:\n> On Tue, 19 May 2009, Chris Friesen wrote:\n\n>> The brute-force way to do this would be to manually loop through each branch\n>> and create a tag of the form \"$branch_$version\" to ensure unique tags.  But I was\n>> hoping there was a more elegant way.\n> \n> Well, I would suggest that you do it fundamentally differently.\n> \n> Instead of tagging each build, I would suggest just associating each build \n> with the commit SHA1 of the time. That's what Linux does (if you enable \n> CONFIG_LOCALVERSION_AUTO), and it's _way_ superior to lots of crazy tags.\n> \n> So for example, I can do\n> \n> \t[torvalds@nehalem ~]$ uname -r\n> \t2.6.30-rc6-00302-g72357d5-dirty\n> \n> and it tells me exactly what kernel version I'm running (well, the \"dirty\"\n> part means that it's not exact and has some additional patches that \n> weren't committed, but that's as close as you can get). It's very useful.\n\nAgreed.  The project in question actually involves (among other things)\na linux kernel build, so we will be making use of this to work backwards\nfrom the running kernel to the commit used to generate it.\n\nHowever, we also want to be able to work in the other direction--given a\nknown-buggy kernel commit, which shipped versions of the product contain\nthe buggy code?  We do in-the-field upgrades, and different sites may be\nrunning different versions, so it's important to be able to easily\ndetermine which sites are currently running the buggy code so that we\ncan get them upgraded.  We know which sites are running which versions,\nso it is useful to tag the repository branches with that version number.\n\n> Trust me, something like the above is _much_ better than tagging each \n> branchthat you build. Partly because it means that you can do the builds \n> in a distributed manner, and they'll all get the version built in, rather \n> than having to rely on everybody tagging everything and then trying to \n> match up the tag to some random binary.\n\nThe tagging would be done only by the \"official\" build process (which\npulls from an \"official\" repository), not by each designer.  Typically\nthe official builds would be done weekly, more frequently if requested.\n\nChris\n"},{"id":"114305","messageId":"alpine.LFD.2.01.0905191403090.3301@localhost.localdomain","threadId":"19417","inReplyTo":"4A131D16.1030001@nortel.com","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-05-19T21:06:39Z","receivedAt":"2009-05-19T21:06:39Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 19 May 2009, Chris Friesen wrote:\n> \n> The tagging would be done only by the \"official\" build process (which\n> pulls from an \"official\" repository), not by each designer.  Typically\n> the official builds would be done weekly, more frequently if requested.\n\nWell, you can tag when you do that official build. Do you really do \n\"official\" builds from all branches? That sounds a bit insane.\n\nRemember: you don't have to tag whatever is the \"top\" - tagging can happen \nlater. Tagging at build-time is perfectly fine.\n\nIn fact, I'd suggest going even further. Don't tag the source branch when \nyou build - tag it after it has passed whatever testing you do (I hope you \n_do_ have some extensive test-suite before release), and as you actually \nmake it public (or whatever you do). Only at _that_ point, tag the tree \nwith \"release-$branch-$date\" or something like that.\n\nRemember: you don't have to tag the top-of branch. You can tag any commit, \nafter-the-fact. So even if you've done other development since, just make \nsure to tag the commit you actually built and tested.\n\n\t\tLinus\n"},{"id":"114306","messageId":"4A132526.6050109@nortel.com","threadId":"19417","inReplyTo":"alpine.LFD.2.01.0905191403090.3301@localhost.localdomain","subject":"Re: any way to apply tag across all branches in repository?","fromName":"Chris Friesen","fromEmail":"cfriesen@nortel.com","sentAt":"2009-05-19T21:31:18Z","receivedAt":"2009-05-19T21:31:18Z","isPatch":false,"sender":{"key":"cfriesen@nortel.com","avatar":null},"body":"Linus Torvalds wrote:\n> \n> On Tue, 19 May 2009, Chris Friesen wrote:\n>> The tagging would be done only by the \"official\" build process (which\n>> pulls from an \"official\" repository), not by each designer.  Typically\n>> the official builds would be done weekly, more frequently if requested.\n> \n> Well, you can tag when you do that official build. Do you really do \n> \"official\" builds from all branches? That sounds a bit insane.\n\nWe have one \"official\" branch for each target board...so maybe a dozen\nor so branches.\n\nDevelopers do private builds, but they're not tagged.\n\n> Remember: you don't have to tag whatever is the \"top\" - tagging can happen \n> later. Tagging at build-time is perfectly fine.\n\nTagging at build-time is actually the plan.\n\n> In fact, I'd suggest going even further. Don't tag the source branch when \n> you build - tag it after it has passed whatever testing you do (I hope you \n> _do_ have some extensive test-suite before release), and as you actually \n> make it public (or whatever you do). Only at _that_ point, tag the tree \n> with \"release-$branch-$date\" or something like that.\n\nThere's a fairly extensive test suite.  This might be an option.\n\n> Remember: you don't have to tag the top-of branch. You can tag any commit, \n> after-the-fact. So even if you've done other development since, just make \n> sure to tag the commit you actually built and tested.\n\nGood point.  I think I've got enough information to get something\nworking.  Thanks for all the help.\n\nChris\n"}]}