Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
tree-walk: replace hard-coded constants with the_hash_algo
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 16 Jul 2018 01:27:54 +0000
(
01:27
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jul 2018 21:27:39 +0000
(14:27 -0700)
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>
tree-walk.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
509f6f6
)
diff --git
a/tree-walk.c
b/tree-walk.c
index 8f5090862b5193db135f18854974b21e75eb8ae4..c1f27086a91479b4342dd4ffadc7b7d609142797 100644
(file)
--- 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;
}