* [PATCH 2/2] Use cache_sha1_file() in git-blame and git-merge-recursive.
@ 2007-02-05 5:51 Junio C Hamano
2007-02-05 5:56 ` Shawn O. Pearce
0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2007-02-05 5:51 UTC (permalink / raw)
To: git
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
cache_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 cache_sha1_file().
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
builtin-blame.c | 2 +-
merge-recursive.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index 897323a..15d0707 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -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);
+ cache_sha1_file(buf, fin_size, blob_type, origin->blob_sha1);
commit->util = origin;
/*
diff --git a/merge-recursive.c b/merge-recursive.c
index a68fcc6..d4e2460 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -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);
+ cache_sha1_file(NULL, 0, tree_type, tree->object.sha1);
merged_common_ancestors = make_virtual_commit(tree, "ancestor");
}
--
1.5.0.rc3.58.g79812
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] Use cache_sha1_file() in git-blame and git-merge-recursive.
2007-02-05 5:51 [PATCH 2/2] Use cache_sha1_file() in git-blame and git-merge-recursive Junio C Hamano
@ 2007-02-05 5:56 ` Shawn O. Pearce
0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2007-02-05 5:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano <junkio@cox.net> wrote:
> 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 cache_sha1_file().
*Excellent* reason for this.
But what about pretend_sha1_file() instead?
The term 'cache' suggests to me (on first glance) that its loading
an existing object and caching it in memory for faster, frequent
access, when compared to other non-cached objects.
--
Shawn.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-05 5:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-05 5:51 [PATCH 2/2] Use cache_sha1_file() in git-blame and git-merge-recursive Junio C Hamano
2007-02-05 5:56 ` Shawn O. Pearce
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).