Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff: switch GIT_SHA1_HEXSZ to use the_hash_algo
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 16 Jul 2018 01:28:05 +0000
(
01:28
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jul 2018 21:27:39 +0000
(14:27 -0700)
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
b7f20f7
)
diff --git
a/diff.c
b/diff.c
index 639eb646b9fa0f07eaeb20a1f0734c177092806d..485ff6c264e1d4edd2cddb47a6f5beae96d26a13 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-3832,7
+3832,7
@@
static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)
char *hex = oid_to_hex(oid);
if (abbrev < 0)
abbrev = FALLBACK_DEFAULT_ABBREV;
char *hex = oid_to_hex(oid);
if (abbrev < 0)
abbrev = FALLBACK_DEFAULT_ABBREV;
- if (abbrev >
GIT_SHA1_HEXSZ
)
+ if (abbrev >
the_hash_algo->hexsz
)
BUG("oid abbreviation out of range: %d", abbrev);
if (abbrev)
hex[abbrev] = '\0';
BUG("oid abbreviation out of range: %d", abbrev);
if (abbrev)
hex[abbrev] = '\0';
@@
-4947,7
+4947,7
@@
const char *diff_aligned_abbrev(const struct object_id *oid, int len)
const char *abbrev;
/* Do we want all 40 hex characters? */
const char *abbrev;
/* Do we want all 40 hex characters? */
- if (len ==
GIT_SHA1_HEXSZ
)
+ if (len ==
the_hash_algo->hexsz
)
return oid_to_hex(oid);
/* An abbreviated value is fine, possibly followed by an ellipsis. */
return oid_to_hex(oid);
/* An abbreviated value is fine, possibly followed by an ellipsis. */
@@
-4977,7
+4977,7
@@
const char *diff_aligned_abbrev(const struct object_id *oid, int len)
* the automatic sizing is supposed to give abblen that ensures
* uniqueness across all objects (statistically speaking).
*/
* the automatic sizing is supposed to give abblen that ensures
* uniqueness across all objects (statistically speaking).
*/
- if (abblen <
GIT_SHA1_HEXSZ
- 3) {
+ if (abblen <
the_hash_algo->hexsz
- 3) {
static char hex[GIT_MAX_HEXSZ + 1];
if (len < abblen && abblen <= len + 2)
xsnprintf(hex, sizeof(hex), "%s%.*s", abbrev, len+3-abblen, "..");
static char hex[GIT_MAX_HEXSZ + 1];
if (len < abblen && abblen <= len + 2)
xsnprintf(hex, sizeof(hex), "%s%.*s", abbrev, len+3-abblen, "..");