@matheusbsbs / matheus-bagliano / commits / 005f85d9ae
Fork 0

Use pretend_sha1_file() in git-blame and git-merge-recursive.

git-merge-recursive wants an null tree as the fake merge base while producing the merge result tree. The null tree does not have to be written out in the object store as it won't be part of the result, and it is a prime example for using the new pretend_sha1_file() function. git-blame needs to register an arbitrary data to in-core index while annotating a working tree file (or standard input), but git-blame is a read-only application and the user of it could even lack the privilege to write into the object store; it is another good example for pretend_sha1_file(). Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 4, 2007 at 21:49 UTC 005f85d9ae95c44d8c6ecf61364642fbcaf49dd2
2 files changed +2 -2
builtin-blame.c
+1 -1
@@ -2005,7 +2005,7 @@ static struct commit *fake_working_tree_commit(const char *path, const char *con
2005 buf[fin_size] = 0;
2006 origin->file.ptr = buf;
2007 origin->file.size = fin_size;
2008 - write_sha1_file(buf, fin_size, blob_type, origin->blob_sha1);
2008 + pretend_sha1_file(buf, fin_size, blob_type, origin->blob_sha1);
2009 commit->util = origin;
2010
2011 /*
merge-recursive.c
+1 -1
@@ -1213,7 +1213,7 @@ static int merge(struct commit *h1,
1213
1214 tree->object.parsed = 1;
1215 tree->object.type = OBJ_TREE;
1216 - write_sha1_file(NULL, 0, tree_type, tree->object.sha1);
1216 + pretend_sha1_file(NULL, 0, tree_type, tree->object.sha1);
1217 merged_common_ancestors = make_virtual_commit(tree, "ancestor");
1218 }
1219