]> git.ipfire.org Git - thirdparty/git.git/commit
Chose better tag names in git-describe after merges.
authorShawn O. Pearce <spearce@spearce.org>
Wed, 10 Jan 2007 11:39:47 +0000 (06:39 -0500)
committerJunio C Hamano <junkio@cox.net>
Fri, 12 Jan 2007 02:05:53 +0000 (18:05 -0800)
commit80dbae03b010b1e5c6e0e4f475578d6cadaadecf
treec7c335d8b79d0a485968bb4e2a397212cc4104cf
parente861ce1692fa9809f3e7b898804f8ddaf7cd8975
Chose better tag names in git-describe after merges.

Recently git.git itself encountered a situation on its master and
next branches where git-describe stopped reporting 'v1.5.0-rc0-gN'
and instead started reporting 'v1.4.4.4-gN'.  This appeared to be
a backward jump in version numbering.

  maint     o-------------------4
            \                    \
  master     o-o-o-o-o-o-o-5-o-C-o-W

The issue is that commit C in the diagram claims it is version
1.5.0, as the tag v1.5.0 is placed on commit 5.  Yet commit W
claims it is version 1.4.4.4 as the tag v1.5.0 has an older tag
date than the v1.4.4.4 tag.

As it turns out this situation is very common.  A bug fix applied
to maint and later merged into master occurs frequently enough that
it should Just Work Right(tm).

Rather than taking the first tag that gets found git-describe will
now generate a list of all possible tags and select the one which
has the most number of commits in common with HEAD (or whatever
revision the user requested the description of).

This rule is based on the principle shown in the diagram above.
There are a large number of commits on the primary development branch
'master' which do not appear in the 'maint' branch, and many of
these are already tagged as part of v1.5.0-rc0.  Additionally these
commits are not in v1.4.4.4, as they are part of the v1.5.0 release
still being developed.  The v1.5.0-rc0 tag is more descriptive of
W than v1.4.4.4 is, and therefore should be used.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-describe.c