Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
pretty: switch hard-coded constants to the_hash_algo
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 16 Jul 2018 01:28:08 +0000
(
01:28
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jul 2018 21:27:40 +0000
(14:27 -0700)
Switch several hard-coded constants into expressions based either on
GIT_MAX_HEXSZ or the_hash_algo.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
94b5e09
)
diff --git
a/pretty.c
b/pretty.c
index 703fa6ff7bf297e9d0dd91586f951f715032e06a..b0e653ff254f0a139a0246f3d49078c8c54493e2 100644
(file)
--- a/
pretty.c
+++ b/
pretty.c
@@
-1575,7
+1575,7
@@
static void pp_header(struct pretty_print_context *pp,
}
if (starts_with(line, "parent ")) {
- if (linelen !=
4
8)
+ if (linelen !=
the_hash_algo->hexsz +
8)
die("bad parent line in commit");
continue;
}
@@
-1583,7
+1583,7
@@
static void pp_header(struct pretty_print_context *pp,
if (!parents_shown) {
unsigned num = commit_list_count(commit->parents);
/* with enough slop */
- strbuf_grow(sb, num *
50
+ 20);
+ strbuf_grow(sb, num *
(GIT_MAX_HEXSZ + 10)
+ 20);
add_merge_info(pp, sb, commit);
parents_shown = 1;
}