@@ -108,14 +108,15 @@ static int handle_line(char *line, struct merge_parents *merge_parents)
108
108
struct string_list_item * item ;
109
109
int pulling_head = 0 ;
110
110
struct object_id oid ;
111
+ const unsigned hexsz = the_hash_algo -> hexsz ;
111
112
112
- if (len < GIT_SHA1_HEXSZ + 3 || line [GIT_SHA1_HEXSZ ] != '\t' )
113
+ if (len < hexsz + 3 || line [hexsz ] != '\t' )
113
114
return 1 ;
114
115
115
- if (starts_with (line + GIT_SHA1_HEXSZ + 1 , "not-for-merge" ))
116
+ if (starts_with (line + hexsz + 1 , "not-for-merge" ))
116
117
return 0 ;
117
118
118
- if (line [GIT_SHA1_HEXSZ + 1 ] != '\t' )
119
+ if (line [hexsz + 1 ] != '\t' )
119
120
return 2 ;
120
121
121
122
i = get_oid_hex (line , & oid );
@@ -130,7 +131,7 @@ static int handle_line(char *line, struct merge_parents *merge_parents)
130
131
131
132
if (line [len - 1 ] == '\n' )
132
133
line [len - 1 ] = 0 ;
133
- line += GIT_SHA1_HEXSZ + 2 ;
134
+ line += hexsz + 2 ;
134
135
135
136
/*
136
137
* At this point, line points at the beginning of comment e.g.
@@ -342,7 +343,7 @@ static void shortlog(const char *name,
342
343
const struct object_id * oid = & origin_data -> oid ;
343
344
int limit = opts -> shortlog_len ;
344
345
345
- branch = deref_tag (parse_object (oid ), oid_to_hex (oid ), GIT_SHA1_HEXSZ );
346
+ branch = deref_tag (parse_object (oid ), oid_to_hex (oid ), the_hash_algo -> hexsz );
346
347
if (!branch || branch -> type != OBJ_COMMIT )
347
348
return ;
348
349
@@ -545,17 +546,17 @@ static void find_merge_parents(struct merge_parents *result,
545
546
int len ;
546
547
char * p = in -> buf + pos ;
547
548
char * newline = strchr (p , '\n' );
549
+ const char * q ;
548
550
struct object_id oid ;
549
551
struct commit * parent ;
550
552
struct object * obj ;
551
553
552
554
len = newline ? newline - p : strlen (p );
553
555
pos += len + !!newline ;
554
556
555
- if (len < GIT_SHA1_HEXSZ + 3 ||
556
- get_oid_hex (p , & oid ) ||
557
- p [GIT_SHA1_HEXSZ ] != '\t' ||
558
- p [GIT_SHA1_HEXSZ + 1 ] != '\t' )
557
+ if (parse_oid_hex (p , & oid , & q ) ||
558
+ q [0 ] != '\t' ||
559
+ q [1 ] != '\t' )
559
560
continue ; /* skip not-for-merge */
560
561
/*
561
562
* Do not use get_merge_parent() here; we do not have
0 commit comments