@@ -1110,17 +1110,17 @@ static void abbrev_sha1_in_line(struct strbuf *line)
1110
1110
split = strbuf_split_max (line , ' ' , 3 );
1111
1111
if (split [0 ] && split [1 ]) {
1112
1112
unsigned char sha1 [20 ];
1113
- const char * abbrev ;
1114
1113
1115
1114
/*
1116
1115
* strbuf_split_max left a space. Trim it and re-add
1117
1116
* it after abbreviation.
1118
1117
*/
1119
1118
strbuf_trim (split [1 ]);
1120
1119
if (!get_sha1 (split [1 ]-> buf , sha1 )) {
1121
- abbrev = find_unique_abbrev (sha1 , DEFAULT_ABBREV );
1122
1120
strbuf_reset (split [1 ]);
1123
- strbuf_addf (split [1 ], "%s " , abbrev );
1121
+ strbuf_add_unique_abbrev (split [1 ], sha1 ,
1122
+ DEFAULT_ABBREV );
1123
+ strbuf_addch (split [1 ], ' ' );
1124
1124
strbuf_reset (line );
1125
1125
for (i = 0 ; split [i ]; i ++ )
1126
1126
strbuf_addbuf (line , split [i ]);
@@ -1343,10 +1343,8 @@ static char *get_branch(const struct worktree *wt, const char *path)
1343
1343
else if (starts_with (sb .buf , "refs/" ))
1344
1344
;
1345
1345
else if (!get_sha1_hex (sb .buf , sha1 )) {
1346
- const char * abbrev ;
1347
- abbrev = find_unique_abbrev (sha1 , DEFAULT_ABBREV );
1348
1346
strbuf_reset (& sb );
1349
- strbuf_addstr (& sb , abbrev );
1347
+ strbuf_add_unique_abbrev (& sb , sha1 , DEFAULT_ABBREV );
1350
1348
} else if (!strcmp (sb .buf , "detached HEAD" )) /* rebase */
1351
1349
goto got_nothing ;
1352
1350
else /* bisect */
0 commit comments