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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 2, 2018 at 00:25 UTC e9fe6f262eab9a262100cbd60355b8c0f346ff59
1 file changed +1 -4
merge.c
+1 -4
@@ -11,10 +11,7 @@
11
12 static const char *merge_argument(struct commit *commit)
13 {
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);
15 }
16
17 int index_has_changes(struct strbuf *sb)