aboutsummaryrefslogtreecommitdiff
path: root/builtin/hash-object.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-05-26 13:49:24 -0700
committerJunio C Hamano <gitster@pobox.com>2015-05-26 13:49:25 -0700
commit1e6c8babf86d8564104e159ce46df069c882a5af (patch)
treef92f0c6616c662aa02ee4ede034bd5a05f70ba11 /builtin/hash-object.c
parent5d5343386414d6097cdba797c88e3bc043dc0074 (diff)
parent1427a7ff70bce0c1040831d5d674c83ebcda6d7d (diff)
downloadgit-1e6c8babf86d8564104e159ce46df069c882a5af.tar.gz
git-1e6c8babf86d8564104e159ce46df069c882a5af.tar.xz
Merge branch 'jc/hash-object' into maint
"hash-object --literally" introduced in v2.2 was not prepared to take a really long object type name. * jc/hash-object: write_sha1_file(): do not use a separate sha1[] array t1007: add hash-object --literally tests hash-object --literally: fix buffer overrun with extra-long object type git-hash-object.txt: document --literally option
Diffstat (limited to 'builtin/hash-object.c')
-rw-r--r--builtin/hash-object.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index 207b90c7b..07fef3cc6 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -22,10 +22,8 @@ static int hash_literally(unsigned char *sha1, int fd, const char *type, unsigne
if (strbuf_read(&buf, fd, 4096) < 0)
ret = -1;
- else if (flags & HASH_WRITE_OBJECT)
- ret = write_sha1_file(buf.buf, buf.len, type, sha1);
else
- ret = hash_sha1_file(buf.buf, buf.len, type, sha1);
+ ret = hash_sha1_file_literally(buf.buf, buf.len, type, sha1, flags);
strbuf_release(&buf);
return ret;
}