@matheusbsbs / matheus-bagliano / commits / 508d9e372e
Fork 0

Fix "--abbrev=xyz" for revision listing

The revision argument parsing was happily parsing "--abbrev", but it didn't parse "--abbrev=<n>". Which was hidden by the fact that the diff options _would_ parse --abbrev=<n>, so it would actually silently parse it, it just wouldn't use it for the same things that a plain "--abbrev" was used for. Which seems a bit insane. With this patch, if you do "git log --abbrev=10" it will abbreviate the merge parent commit ID's to ten hex characters, which was probably what you expected. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed May 27, 2006 at 12:24 UTC 508d9e372e0e3cfa55a6224eca5e214364fc66b4
1 file changed +8
revision.c
+8
@@ -733,6 +733,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
733 revs->abbrev = DEFAULT_ABBREV;
734 continue;
735 }
736 + if (!strncmp(arg, "--abbrev=", 9)) {
737 + revs->abbrev = strtoul(arg + 9, NULL, 10);
738 + if (revs->abbrev < MINIMUM_ABBREV)
739 + revs->abbrev = MINIMUM_ABBREV;
740 + else if (revs->abbrev > 40)
741 + revs->abbrev = 40;
742 + continue;
743 + }
744 if (!strcmp(arg, "--abbrev-commit")) {
745 revs->abbrev_commit = 1;
746 continue;