Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
revision: replace use of hard-coded constants
author
brian m. carlson
<sandals@crustytoothpaste.net>
Wed, 2 May 2018 00:25:50 +0000
(
00:25
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 2 May 2018 04:59:51 +0000
(13:59 +0900)
Replace two uses of the hard-coded constant 40 with references to
the_hash_algo.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
dd724bc
)
diff --git
a/revision.c
b/revision.c
index ce0e7b71f2b8d9035f863186c5519951a1049880..daf7fe6ff4c173d7a7cd920019cea4bd7d308965 100644
(file)
--- a/
revision.c
+++ b/
revision.c
@@
-1751,6
+1751,7
@@
static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
const char *arg = argv[0];
const char *optarg;
int argcount;
const char *arg = argv[0];
const char *optarg;
int argcount;
+ const unsigned hexsz = the_hash_algo->hexsz;
/* pseudo revision arguments */
if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
/* pseudo revision arguments */
if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
@@
-2038,8
+2039,8
@@
static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->abbrev = strtoul(optarg, NULL, 10);
if (revs->abbrev < MINIMUM_ABBREV)
revs->abbrev = MINIMUM_ABBREV;
revs->abbrev = strtoul(optarg, NULL, 10);
if (revs->abbrev < MINIMUM_ABBREV)
revs->abbrev = MINIMUM_ABBREV;
- else if (revs->abbrev >
40
)
- revs->abbrev =
40
;
+ else if (revs->abbrev >
hexsz
)
+ revs->abbrev =
hexsz
;
} else if (!strcmp(arg, "--abbrev-commit")) {
revs->abbrev_commit = 1;
revs->abbrev_commit_given = 1;
} else if (!strcmp(arg, "--abbrev-commit")) {
revs->abbrev_commit = 1;
revs->abbrev_commit_given = 1;