]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Use pretend_sha1_file() in git-blame and git-merge-recursive.
authorJunio C Hamano <junkio@cox.net>
Mon, 5 Feb 2007 05:49:05 +0000 (21:49 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 5 Feb 2007 22:55:11 +0000 (14:55 -0800)
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>
builtin-blame.c
merge-recursive.c

index 897323a4b23201150b675ed34bb1cba9479d988d..fb30c49280817b1b4f89608948a889cc65d98bd3 100644 (file)
@@ -2005,7 +2005,7 @@ static struct commit *fake_working_tree_commit(const char *path, const char *con
        buf[fin_size] = 0;
        origin->file.ptr = buf;
        origin->file.size = fin_size;
-       write_sha1_file(buf, fin_size, blob_type, origin->blob_sha1);
+       pretend_sha1_file(buf, fin_size, blob_type, origin->blob_sha1);
        commit->util = origin;
 
        /*
index a68fcc6f377fc5df3ec0527e9bfe552754c81ede..58989424d77467da018e7daf5761f1f85040d2f6 100644 (file)
@@ -1213,7 +1213,7 @@ static int merge(struct commit *h1,
 
                tree->object.parsed = 1;
                tree->object.type = OBJ_TREE;
-               write_sha1_file(NULL, 0, tree_type, tree->object.sha1);
+               pretend_sha1_file(NULL, 0, tree_type, tree->object.sha1);
                merged_common_ancestors = make_virtual_commit(tree, "ancestor");
        }