summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorKarsten Blees <karsten.blees@gmail.com>2014-07-03 00:20:20 +0200
committerJunio C Hamano <gitster@pobox.com>2014-07-07 13:56:24 -0700
commit039dc71a7cb824300e242f8abc0fcb19dac93641 (patch)
tree9c38bb8655e0314cfe122b7355922c2413533825 /diffcore-rename.c
parent6f92e5ff3cdc813de8ef5327fd4bad492fb7d6c9 (diff)
downloadgit-039dc71a7cb824300e242f8abc0fcb19dac93641.tar.gz
hashmap: factor out getting a hash code from a SHA1
Copying the first bytes of a SHA1 is duplicated in six places, however, the implications (the actual value would depend on the endianness of the platform) is documented only once. Add a properly documented API for this. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 749a35d2c2..6fa97d4433 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -242,14 +242,12 @@ struct file_similarity {
static unsigned int hash_filespec(struct diff_filespec *filespec)
{
- unsigned int hash;
if (!filespec->sha1_valid) {
if (diff_populate_filespec(filespec, 0))
return 0;
hash_sha1_file(filespec->data, filespec->size, "blob", filespec->sha1);
}
- memcpy(&hash, filespec->sha1, sizeof(hash));
- return hash;
+ return sha1hash(filespec->sha1);
}
static int find_identical_files(struct hashmap *srcs,