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>
This commit is contained in:
brian m. carlson 2018-05-02 00:25:57 +00:00 committed by Junio C Hamano
parent cb91022c0e
commit e9fe6f262e
1 changed files with 1 additions and 4 deletions

View File

@ -11,10 +11,7 @@
static const char *merge_argument(struct commit *commit)
{
if (commit)
return oid_to_hex(&commit->object.oid);
else
return EMPTY_TREE_SHA1_HEX;
return oid_to_hex(commit ? &commit->object.oid : the_hash_algo->empty_tree);
}
int index_has_changes(struct strbuf *sb)