git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How can I automatically create a GIT branch that represents a sequence of tags?
@ 2013-08-10 22:29 Kristian Freed
  2013-08-10 23:20 ` Fredrik Gustafsson
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kristian Freed @ 2013-08-10 22:29 UTC (permalink / raw)
  To: git

In our current setup, we have automatic tagging in git of all
successful release builds. This makes it easy to go back to stable
points in history and compare functionality, check when bugs were
introduced etc.

To help with this process further, it would be useful to be able to
use git bisect, but as these are just a sequence of tags, not commits
on a branch, git bisect will not work as is.

Is there any tooling for automatically recreating a branch from a
sequence of tags, where each generated commit is the calculated delta
between each two neighbouring tags?

Thanks,
Kristian

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-10 22:29 How can I automatically create a GIT branch that represents a sequence of tags? Kristian Freed
@ 2013-08-10 23:20 ` Fredrik Gustafsson
  2013-08-11  5:16   ` Michael Haggerty
                     ` (2 more replies)
  2013-08-11  9:36 ` Andreas Schwab
  2013-08-11 10:16 ` Felipe Contreras
  2 siblings, 3 replies; 9+ messages in thread
From: Fredrik Gustafsson @ 2013-08-10 23:20 UTC (permalink / raw)
  To: Kristian Freed; +Cc: git

On Sat, Aug 10, 2013 at 11:29:45PM +0100, Kristian Freed wrote:
> In our current setup, we have automatic tagging in git of all
> successful release builds. This makes it easy to go back to stable
> points in history and compare functionality, check when bugs were
> introduced etc.
> 
> To help with this process further, it would be useful to be able to
> use git bisect, but as these are just a sequence of tags, not commits
> on a branch, git bisect will not work as is.
> 
> Is there any tooling for automatically recreating a branch from a
> sequence of tags, where each generated commit is the calculated delta
> between each two neighbouring tags?

I don't understand, why is it better to find between which tags a error
was found and not in what commit. It's much easier to find a bug
introduced in a commit than in a tag/release. It sounds like you're
doing the bug hunting harder. Could you explain this further?

It would be very hard to do a tool such as you describe, the reason is
that there's no sane way to order your tags. Git today show tags
alphabetically, all versions does not have a alphabtic order. You could
argue that it should be in the order of the tagged commits commit date,
however the commits are not ordered by date, an older commit can have a
younger commit as a parent. You could say that the tag order is the
order you find the tags if you go from a branch and backwards in the
history, however how do you then choose which path to take when you find
a merge?

My suggestion if you want to do this, is to have your buildtool to
checkout a special branch (let's call it tag_branch) do a git reset
to get the worktree from the newly tagged commit and commit on that
branch once for each tag it's creating, when it creates the tag.

It would be quite easy to make a script that create such branch for you,
if you only can sort the tags somehow.

-- 
Med vänliga hälsningar
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-10 23:20 ` Fredrik Gustafsson
@ 2013-08-11  5:16   ` Michael Haggerty
  2013-08-11  6:20     ` Fredrik Gustafsson
  2013-08-11  7:49   ` Philip Oakley
  2013-08-11 11:13   ` Kristian Freed
  2 siblings, 1 reply; 9+ messages in thread
From: Michael Haggerty @ 2013-08-11  5:16 UTC (permalink / raw)
  To: Fredrik Gustafsson; +Cc: Kristian Freed, git

On 08/11/2013 01:20 AM, Fredrik Gustafsson wrote:
> [...]
> It would be very hard to do a tool such as you describe, the reason is
> that there's no sane way to order your tags. Git today show tags
> alphabetically, all versions does not have a alphabtic order. [...]
> It would be quite easy to make a script that create such branch for you,
> if you only can sort the tags somehow.

GNU sort has a nice option that can sort this way:

  -V, --version-sort
     Sort by version name and number.  It behaves like a standard sort,
     except that each sequence of decimal digits is treated numerically
     as an index/version number.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-11  5:16   ` Michael Haggerty
@ 2013-08-11  6:20     ` Fredrik Gustafsson
  0 siblings, 0 replies; 9+ messages in thread
From: Fredrik Gustafsson @ 2013-08-11  6:20 UTC (permalink / raw)
  To: Michael Haggerty; +Cc: Fredrik Gustafsson, Kristian Freed, git

On Sun, Aug 11, 2013 at 07:16:30AM +0200, Michael Haggerty wrote:
> On 08/11/2013 01:20 AM, Fredrik Gustafsson wrote:
> > [...]
> > It would be very hard to do a tool such as you describe, the reason is
> > that there's no sane way to order your tags. Git today show tags
> > alphabetically, all versions does not have a alphabtic order. [...]
> > It would be quite easy to make a script that create such branch for you,
> > if you only can sort the tags somehow.
> 
> GNU sort has a nice option that can sort this way:
> 
>   -V, --version-sort
>      Sort by version name and number.  It behaves like a standard sort,
>      except that each sequence of decimal digits is treated numerically
>      as an index/version number.

That's a nice feature, I remember we had  that one as a feature request
for git tag just a few days ago. It works well with git.git version
numbers but won't be usefull in this case for git.git since git.git has
other tags too (like the gitgui version tags). However if you've a nice
namespace for the tags where you only tags versions, it might be an
alternative.

-- 
Med vänliga hälsningar
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-10 23:20 ` Fredrik Gustafsson
  2013-08-11  5:16   ` Michael Haggerty
@ 2013-08-11  7:49   ` Philip Oakley
  2013-08-11 11:13   ` Kristian Freed
  2 siblings, 0 replies; 9+ messages in thread
From: Philip Oakley @ 2013-08-11  7:49 UTC (permalink / raw)
  To: Fredrik Gustafsson, Kristian Freed; +Cc: git

From: "Fredrik Gustafsson" <iveqy@iveqy.com>
> On Sat, Aug 10, 2013 at 11:29:45PM +0100, Kristian Freed wrote:
>> In our current setup, we have automatic tagging in git of all
>> successful release builds. This makes it easy to go back to stable
>> points in history and compare functionality, check when bugs were
>> introduced etc.
>>
>> To help with this process further, it would be useful to be able to
>> use git bisect, but as these are just a sequence of tags, not commits
>> on a branch, git bisect will not work as is.

I was going to say simply use `git describe --contains <sha1>` and check 
the result is <tag>^0 first and then either skip the commit (git bisect 
skip) or test it.

Unfortunately I think it will conflict with the binary search style 
(i.e. a too sparse history with good tags). In such case it may be 
useful to have an alternate search style but that would be a code 
update.

>>
>> Is there any tooling for automatically recreating a branch from a
>> sequence of tags, where each generated commit is the calculated delta
>> between each two neighbouring tags?
>
> I don't understand, why is it better to find between which tags a 
> error
> was found and not in what commit. It's much easier to find a bug
> introduced in a commit than in a tag/release. It sounds like you're
> doing the bug hunting harder. Could you explain this further?
>
I can see that in many commercial environments that this would be 
considered "best practice" (which actually equates to common practice, 
rather than good practice). Obviously in a FOSS environment the 
developers are willing to use the 'rebase until ready' approaches until 
their patches are acceptable. In a large corporate it can be that the 
fixes are locally good but globally bad, hence the extra tagging step.

> It would be very hard to do a tool such as you describe, the reason is
> that there's no sane way to order your tags. Git today show tags
> alphabetically, all versions does not have a alphabtic order. You 
> could
> argue that it should be in the order of the tagged commits commit 
> date,
> however the commits are not ordered by date, an older commit can have 
> a
> younger commit as a parent. You could say that the tag order is the
> order you find the tags if you go from a branch and backwards in the
> history, however how do you then choose which path to take when you 
> find
> a merge?
>
> My suggestion if you want to do this, is to have your buildtool to
> checkout a special branch (let's call it tag_branch) do a git reset
> to get the worktree from the newly tagged commit and commit on that
> branch once for each tag it's creating, when it creates the tag.
>
> It would be quite easy to make a script that create such branch for 
> you,
> if you only can sort the tags somehow.
>
> -- 
> Med vänliga hälsningar
> Fredrik Gustafsson
>
--
Philip 

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-10 22:29 How can I automatically create a GIT branch that represents a sequence of tags? Kristian Freed
  2013-08-10 23:20 ` Fredrik Gustafsson
@ 2013-08-11  9:36 ` Andreas Schwab
  2013-08-11 10:16 ` Felipe Contreras
  2 siblings, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2013-08-11  9:36 UTC (permalink / raw)
  To: Kristian Freed; +Cc: git

Kristian Freed <kristian.freed@gmail.com> writes:

> To help with this process further, it would be useful to be able to
> use git bisect, but as these are just a sequence of tags, not commits
> on a branch, git bisect will not work as is.

git bisect takes arbitrary revisions, there is no restriction on using
tags as bounds.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-10 22:29 How can I automatically create a GIT branch that represents a sequence of tags? Kristian Freed
  2013-08-10 23:20 ` Fredrik Gustafsson
  2013-08-11  9:36 ` Andreas Schwab
@ 2013-08-11 10:16 ` Felipe Contreras
  2 siblings, 0 replies; 9+ messages in thread
From: Felipe Contreras @ 2013-08-11 10:16 UTC (permalink / raw)
  To: Kristian Freed; +Cc: git

On Sat, Aug 10, 2013 at 5:29 PM, Kristian Freed
<kristian.freed@gmail.com> wrote:
> In our current setup, we have automatic tagging in git of all
> successful release builds. This makes it easy to go back to stable
> points in history and compare functionality, check when bugs were
> introduced etc.
>
> To help with this process further, it would be useful to be able to
> use git bisect, but as these are just a sequence of tags, not commits
> on a branch, git bisect will not work as is.

Why don't you just do 'git bisect skip' if the commit doesn't have a tag?

> Is there any tooling for automatically recreating a branch from a
> sequence of tags, where each generated commit is the calculated delta
> between each two neighbouring tags?

That would probably involve listing the wanted tags:

% git log --topo-order --simplify-by-decoration --decorate --oneline

And then generating the commits:

% git cat-file -p v1.8.3 > commit
# modify commit's parent
% git hash-object -w < commit

-- 
Felipe Contreras

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-10 23:20 ` Fredrik Gustafsson
  2013-08-11  5:16   ` Michael Haggerty
  2013-08-11  7:49   ` Philip Oakley
@ 2013-08-11 11:13   ` Kristian Freed
  2013-08-11 12:23     ` Fredrik Gustafsson
  2 siblings, 1 reply; 9+ messages in thread
From: Kristian Freed @ 2013-08-11 11:13 UTC (permalink / raw)
  To: Fredrik Gustafsson; +Cc: git

On Sun, Aug 11, 2013 at 12:20 AM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
> I don't understand, why is it better to find between which tags a error
> was found and not in what commit. It's much easier to find a bug
> introduced in a commit than in a tag/release. It sounds like you're
> doing the bug hunting harder. Could you explain this further?

For better or worse, the current state includes a lot of noisy "fixing
tests" type commits which I
would like to automatically skip over when hunting bugs. This is not
great and is being addressed,
but I am trying to make the most of the historical data we have today
- which does contain tags
for all builds that passed automated testing etc but does not have
only good commits on the related
branch.

> My suggestion if you want to do this, is to have your buildtool to
> checkout a special branch (let's call it tag_branch) do a git reset
> to get the worktree from the newly tagged commit and commit on that
> branch once for each tag it's creating, when it creates the tag.

I can see how this would work, but only for future builds. I would
need something like it but loop
over all existing tags as this is a problem with historical data.
Could you please be more specific
as to the steps required to automatically form a commit that
represents the change between
two commits (i.e. tags)?

Thanks,
Kristian

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

* Re: How can I automatically create a GIT branch that represents a sequence of tags?
  2013-08-11 11:13   ` Kristian Freed
@ 2013-08-11 12:23     ` Fredrik Gustafsson
  0 siblings, 0 replies; 9+ messages in thread
From: Fredrik Gustafsson @ 2013-08-11 12:23 UTC (permalink / raw)
  To: Kristian Freed; +Cc: Fredrik Gustafsson, git

On Sun, Aug 11, 2013 at 12:13:18PM +0100, Kristian Freed wrote:
> On Sun, Aug 11, 2013 at 12:20 AM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
> > I don't understand, why is it better to find between which tags a error
> > was found and not in what commit. It's much easier to find a bug
> > introduced in a commit than in a tag/release. It sounds like you're
> > doing the bug hunting harder. Could you explain this further?
> 
> For better or worse, the current state includes a lot of noisy "fixing
> tests" type commits which I
> would like to automatically skip over when hunting bugs. This is not
> great and is being addressed,
> but I am trying to make the most of the historical data we have today
> - which does contain tags
> for all builds that passed automated testing etc but does not have
> only good commits on the related
> branch.

Thank you, that make sense (even if it's really sad to have such
history).

> 
> > My suggestion if you want to do this, is to have your buildtool to
> > checkout a special branch (let's call it tag_branch) do a git reset
> > to get the worktree from the newly tagged commit and commit on that
> > branch once for each tag it's creating, when it creates the tag.
> 
> I can see how this would work, but only for future builds. I would
> need something like it but loop
> over all existing tags as this is a problem with historical data.
> Could you please be more specific
> as to the steps required to automatically form a commit that
> represents the change between
> two commits (i.e. tags)?
> 

Create an orphan branch:
git checkout --orphan tag_branch

Now for every tag, t:
git checkout t
git reset --soft tag_branch
git add .
git commit -m "t"


-- 
Med vänliga hälsningar
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com

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

end of thread, other threads:[~2013-08-11 12:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-10 22:29 How can I automatically create a GIT branch that represents a sequence of tags? Kristian Freed
2013-08-10 23:20 ` Fredrik Gustafsson
2013-08-11  5:16   ` Michael Haggerty
2013-08-11  6:20     ` Fredrik Gustafsson
2013-08-11  7:49   ` Philip Oakley
2013-08-11 11:13   ` Kristian Freed
2013-08-11 12:23     ` Fredrik Gustafsson
2013-08-11  9:36 ` Andreas Schwab
2013-08-11 10:16 ` Felipe Contreras

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