summaryrefslogtreecommitdiff
path: root/tree-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-11-01 09:17:37 -0800
committerJunio C Hamano <junkio@cox.net>2006-11-01 09:17:37 -0800
commit56532fa147d56057ad4121f5ccea8e254748afdd (patch)
treef5536ca0d7ba9ca232ea606ebc6f501d396a4b98 /tree-diff.c
parente0d68cd5d95fc15342db38c211f71efe5bcfbe94 (diff)
parent2b60356da5369dd60ab26eabaa91d95b6badf209 (diff)
downloadgit-56532fa147d56057ad4121f5ccea8e254748afdd.tar.gz
Merge branch 'rs/cherry'
* rs/cherry: Make git-cherry handle root trees Built-in cherry
Diffstat (limited to 'tree-diff.c')
-rw-r--r--tree-diff.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tree-diff.c b/tree-diff.c
index 7e2f4f088a..37d235e06e 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -215,6 +215,24 @@ int diff_tree_sha1(const unsigned char *old, const unsigned char *new, const cha
return retval;
}
+int diff_root_tree_sha1(const unsigned char *new, const char *base, struct diff_options *opt)
+{
+ int retval;
+ void *tree;
+ struct tree_desc empty, real;
+
+ tree = read_object_with_reference(new, tree_type, &real.size, NULL);
+ if (!tree)
+ die("unable to read root tree (%s)", sha1_to_hex(new));
+ real.buf = tree;
+
+ empty.size = 0;
+ empty.buf = "";
+ retval = diff_tree(&empty, &real, base, opt);
+ free(tree);
+ return retval;
+}
+
static int count_paths(const char **paths)
{
int i = 0;