summaryrefslogtreecommitdiff
path: root/describe.c
AgeCommit message (Collapse)AuthorFilesLines
2006-06-28Make some strings constLibravatar Timo Hirvonen1-1/+1
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-17Shrink "struct object" a bitLibravatar Linus Torvalds1-1/+1
This shrinks "struct object" by a small amount, by getting rid of the "struct type *" pointer and replacing it with a 3-bit bitfield instead. In addition, we merge the bitfields and the "flags" field, which incidentally should also remove a useless 4-byte padding from the object when in 64-bit mode. Now, our "struct object" is still too damn large, but it's now less obviously bloated, and of the remaining fields, only the "util" (which is not used by most things) is clearly something that should be eventually discarded. This shrinks the "git-rev-list --all" memory use by about 2.5% on the kernel archive (and, perhaps more importantly, on the larger mozilla archive). That may not sound like much, but I suspect it's more on a 64-bit platform. There are other remaining inefficiencies (the parent lists, for example, probably have horrible malloc overhead), but this was pretty obvious. Most of the patch is just changing the comparison of the "type" pointer from one of the constant string pointers to the appropriate new TYPE_xxx small integer constant. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-08Separate object name errors from usage errorsLibravatar Dmitry V. Levin1-3/+3
Separate object name errors from usage errors. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-28abbrev cleanup: use symbolic constantsLibravatar Junio C Hamano1-2/+1
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-15Merge fixes up to GIT 1.1.3Libravatar Junio C Hamano1-5/+8
2006-01-15describe: omit clearing marks on the last one.Libravatar Junio C Hamano1-3/+4
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-13Merge fixes up to GIT 1.1.2Libravatar Junio C Hamano1-2/+3
2006-01-11git-describe: default to HEADLibravatar Junio C Hamano1-16/+22
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-11describe: do not silently ignore indescribable commitsLibravatar Junio C Hamano1-2/+3
We silently ignored indescribable commits without complaining. Complain and die instead. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-08GIT 1.1.0Libravatar Junio C Hamano1-1/+1
2006-01-07describe: allow more than one revs to be named.Libravatar Junio C Hamano1-1/+2
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>
2005-12-27git-describe: still prefer annotated tag under --all and --tagsLibravatar Junio C Hamano1-9/+25
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-27git-describe: --tags and --abbrevLibravatar Junio C Hamano1-6/+27
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-27git-describe: use find_unique_abbrev()Libravatar Junio C Hamano1-1/+2
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-27git-describe: really prefer tags only.Libravatar Junio C Hamano1-4/+11
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-27Add a "git-describe" commandLibravatar Linus Torvalds1-0/+118
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 2414721b194453f058079d897d13c4e377f92dc6. 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>