@@ -30,6 +30,7 @@ static const char rev_list_usage[] =
3030" --unpacked\n"
3131" --header | --pretty\n"
3232" --abbrev=nr | --no-abbrev\n"
33+ " --abbrev-commit\n"
3334" special purpose:\n"
3435" --bisect"
3536;
@@ -39,6 +40,7 @@ struct rev_info revs;
3940static int bisect_list = 0 ;
4041static int verbose_header = 0 ;
4142static int abbrev = DEFAULT_ABBREV ;
43+ static int abbrev_commit = 0 ;
4244static int show_timestamp = 0 ;
4345static int hdr_termination = 0 ;
4446static const char * commit_prefix = "" ;
@@ -52,7 +54,10 @@ static void show_commit(struct commit *commit)
5254 fputs (commit_prefix , stdout );
5355 if (commit -> object .flags & BOUNDARY )
5456 putchar ('-' );
55- fputs (sha1_to_hex (commit -> object .sha1 ), stdout );
57+ if (abbrev_commit && abbrev )
58+ fputs (find_unique_abbrev (commit -> object .sha1 , abbrev ), stdout );
59+ else
60+ fputs (sha1_to_hex (commit -> object .sha1 ), stdout );
5661 if (revs .parents ) {
5762 struct commit_list * parents = commit -> parents ;
5863 while (parents ) {
@@ -319,6 +324,14 @@ int main(int argc, const char **argv)
319324 abbrev = 0 ;
320325 continue ;
321326 }
327+ if (!strcmp (arg , "--abbrev" )) {
328+ abbrev = DEFAULT_ABBREV ;
329+ continue ;
330+ }
331+ if (!strcmp (arg , "--abbrev-commit" )) {
332+ abbrev_commit = 1 ;
333+ continue ;
334+ }
322335 if (!strncmp (arg , "--abbrev=" , 9 )) {
323336 abbrev = strtoul (arg + 9 , NULL , 10 );
324337 if (abbrev && abbrev < MINIMUM_ABBREV )
0 commit comments