Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-07-16 04:27:54 +0300
committerJunio C Hamano <gitster@pobox.com>2018-07-17 00:27:39 +0300
commit83e4b7571c7d78e8236ad87519b75a90e7902a34 (patch)
treea350ecc2b655ba25dc945fcf8a30037c41678a60 /tree-walk.c
parent509f6f62a4b0dfd1c06dc2120ad06b9d50a1b64a (diff)
tree-walk: replace hard-coded constants with the_hash_algo
Remove the hard-coded 20-based values and replace them with uses of the_hash_algo. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tree-walk.c b/tree-walk.c
index 8f5090862b..c1f27086a9 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -26,8 +26,9 @@ static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned l
{
const char *path;
unsigned int mode, len;
+ const unsigned hashsz = the_hash_algo->rawsz;
- if (size < 23 || buf[size - 21]) {
+ if (size < hashsz + 3 || buf[size - (hashsz + 1)]) {
strbuf_addstr(err, _("too-short tree object"));
return -1;
}