summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorRene Scharfe <rene.scharfe@lsrfire.ath.cx>2006-10-14 10:45:36 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-10-14 18:49:52 (GMT)
commitabdc3fc84216a9334f40f3b7ce13e20a825697d0 (patch)
tree05a066dcb1ff662962794be159f23ca05714aa2a /cache-tree.c
parentce91fc6eb9c4aefc73f845fc7104f332b2b308d2 (diff)
downloadgit-abdc3fc84216a9334f40f3b7ce13e20a825697d0.zip
git-abdc3fc84216a9334f40f3b7ce13e20a825697d0.tar.gz
git-abdc3fc84216a9334f40f3b7ce13e20a825697d0.tar.bz2
Add hash_sha1_file()
Most callers of write_sha1_file_prepare() are only interested in the resulting hash but don't care about the returned file name or the header. This patch adds a simple wrapper named hash_sha1_file() which does just that, and converts potential callers. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 323c68a..d388848 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -344,12 +344,8 @@ static int update_one(struct cache_tree *it,
#endif
}
- if (dryrun) {
- unsigned char hdr[200];
- int hdrlen;
- write_sha1_file_prepare(buffer, offset, tree_type, it->sha1,
- hdr, &hdrlen);
- }
+ if (dryrun)
+ hash_sha1_file(buffer, offset, tree_type, it->sha1);
else
write_sha1_file(buffer, offset, tree_type, it->sha1);
free(buffer);