Граф коммитов

13 Коммитов

Автор SHA1 Сообщение Дата
Junio C Hamano 46a6c2620b abbrev cleanup: use symbolic constants
The minimum length of abbreviated object name was hardcoded in
different places to be 4, risking inconsistencies in the future.
Also there were three different "default abbreviation
precision".  Use two C preprocessor symbols to clean up this
mess.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-28 00:09:38 -08:00
Junio C Hamano fec9ebf16c Merge fixes up to GIT 1.1.3 2006-01-15 22:25:35 -08:00
Junio C Hamano 181dc77695 describe: omit clearing marks on the last one.
When describing more than one, we need to clear the commit marks
before handling the next one, but most of the time we are
running it for only one commit, and in such a case this clearing
phase is totally unnecessary.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-15 22:15:37 -08:00
Junio C Hamano 429608fc36 Merge fixes up to GIT 1.1.2 2006-01-13 16:51:21 -08:00
Junio C Hamano 4c34a2c555 git-describe: default to HEAD
This is based on the patch by Andreas Ericsson, but done slightly
differently, preferring to have separate loops -- one for options
and then arguments.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 13:58:32 -08:00
Junio C Hamano 8c23b6fae2 describe: do not silently ignore indescribable commits
We silently ignored indescribable commits without complaining.
Complain and die instead.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 13:41:25 -08:00
Junio C Hamano 5a2282de13 GIT 1.1.0 2006-01-08 14:22:19 -08:00
Junio C Hamano f8f9c73c7d describe: allow more than one revs to be named.
The main loop was prepared to take more than one revs, but the actual
naming logic wad not (it used pop_most_recent_commit while forgetting
that the commit marks stay after it's done).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:43:01 -08:00
Junio C Hamano 64deb858b0 git-describe: still prefer annotated tag under --all and --tags
Even though --all and --tags can be used to include non
annotated tags in the reference point candidates, prefer to use
annotated tags if there are more than one refs that name the
same commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
Junio C Hamano 2d9e7c9f90 git-describe: --tags and --abbrev
With --tags, not just annontated tags, but also any ref under
refs/tags/ are used to name the revision.

The number of digits is configurable with the --abbrev=<n> option.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
Junio C Hamano 4cdf78bf96 git-describe: use find_unique_abbrev()
Just in case 8 hexadecimal digits are not enough.  We could use
shorter default if we wanted to.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
Junio C Hamano 635d413430 git-describe: really prefer tags only.
Often there are references other than annotated tags under
refs/tags hierarchy that are used to "keep things just in case".
default to use annotated tags only, still leaving the option to
use any ref with --all flag.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
Linus Torvalds 908e5310b9 Add a "git-describe" command
It shows you the most recent tag that is reachable from a particular
commit is.

Maybe this is something that "git-name-rev" should be taught to do,
instead of having a separate command for it. Regardless, I find it useful.

What it does is to take any random commit, and "name" it by looking up the
most recent commit that is tagged and reachable from that commit. If the
match is exact, it will just print out that ref-name directly. Otherwise
it will print out the ref-name, followed by the 8-character "short SHA".

IOW, with something like Junios current tree, I get:

	[torvalds@g5 git]$ git-describe parent
	refs/tags/v1.0.4-g2414721b

ie the current head of my "parent" branch (ie Junio) is based on v1.0.4,
but since it has a few commits on top of that, it has added the git hash
of the thing to the end: "-g" + 8-char shorthand for the commit
2414721b19.

Doing a "git-describe" on a tag-name will just show the full tag path:

	[torvalds@g5 git]$ git-describe v1.0.4
	refs/tags/v1.0.4

unless there are _other_ tags pointing to that commit, in which case it
will just choose one at random.

This is useful for two things:

 - automatic version naming in Makefiles, for example. We could use it in
   git itself: when doing "git --version", we could use this to give a
   much more useful description of exactly what version was installed.

 - for any random commit (say, you use "gitk <pathname>" or
   "git-whatchanged" to look at what has changed in some file), you can
   figure out what the last version of the repo was. Ie, say I find a bug
   in commit 39ca371c45b04cd50d0974030ae051906fc516b6, I just do:

	[torvalds@g5 linux]$ git-describe 39ca371c45b04cd50d0974030ae051906fc516b6
	refs/tags/v2.6.14-rc4-g39ca371c

   and I now know that it was _not_ in v2.6.14-rc4, but was presumably in
   v2.6.14-rc5.

The latter is useful when you want to see what "version timeframe" a
commit happened in.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00