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>
This commit is contained in:
Rene Scharfe
2006-10-14 12:45:36 +02:00
committed by Junio C Hamano
parent ce91fc6eb9
commit abdc3fc842
5 changed files with 22 additions and 34 deletions

View File

@ -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);