Thread (45 messages) 45 messages, 2 authors, 2018-05-02

[PATCH v2 29/42] merge: convert empty tree constant to the_hash_algo

STALE3075d

From: brian m. carlson <hidden>
Date: 2018-05-02 00:27:53
Subsystem: the rest · Maintainer: Linus Torvalds

Revision v2 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v2 current
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 <redacted>
---
 merge.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/merge.c b/merge.c
index f06a4773d4..5186cb6156 100644
--- a/merge.c
+++ b/merge.c
@@ -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)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help