Skip to content

Commit e9fe6f2

Browse files
bk2204gitster
authored andcommitted
merge: convert empty tree constant to the_hash_algo
To avoid dependency on a particular hash algorithm, convert a use of EMPTY_TREE_SHA1_HEX to use the_hash_algo->empty_tree instead. Since both branches now use oid_to_hex, condense the if statement into a ternary. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cb91022 commit e9fe6f2

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

merge.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111

1212
static const char *merge_argument(struct commit *commit)
1313
{
14-
if (commit)
15-
return oid_to_hex(&commit->object.oid);
16-
else
17-
return EMPTY_TREE_SHA1_HEX;
14+
return oid_to_hex(commit ? &commit->object.oid : the_hash_algo->empty_tree);
1815
}
1916

2017
int index_has_changes(struct strbuf *sb)

0 commit comments

Comments
 (0)