tree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL
Now since diff_tree_sha1 understands NULL for both old and new, we could indicate an empty tree for root commit by providing just NULL for old sha1. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kirill Smelkov committed
Feb 5, 2014 at 20:57 UTC
0b707c3319f37f2ec3700638d62f3199af40c138
1 file changed
+1
-14
tree-diff.c
+1
-14
@@ -311,18 +311,5 @@ int diff_tree_sha1(const unsigned char *old, const unsigned char *new, const cha
311
312
int diff_root_tree_sha1(const unsigned char *new, const char *base, struct diff_options *opt)
313
{
314
- int retval;
315
- void *tree;
316
- unsigned long size;
317
- struct tree_desc empty, real;
318
-
319
- tree = read_object_with_reference(new, tree_type, &size, NULL);
320
- if (!tree)
321
- die("unable to read root tree (%s)", sha1_to_hex(new));
322
- init_tree_desc(&real, tree, size);
323
-
324
- init_tree_desc(&empty, "", 0);
325
- retval = diff_tree(&empty, &real, base, opt);
326
- free(tree);
327
- return retval;
314
+ return diff_tree_sha1(NULL, new, base, opt);
315
}