summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-02 22:30:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-02 22:30:39 (GMT)
commit37aac3e408fa2348983e964f8bda2de581f2c44e (patch)
tree1a59edd1eb2ece6e597342460b5b199ef2c5624b /diff.c
parentbba1a5559cd0015165563fd01d23bbd5e52bea72 (diff)
parent580f0980e11b9dcfdaf0f8af12b8cef7c702a7e1 (diff)
downloadgit-37aac3e408fa2348983e964f8bda2de581f2c44e.zip
git-37aac3e408fa2348983e964f8bda2de581f2c44e.tar.gz
git-37aac3e408fa2348983e964f8bda2de581f2c44e.tar.bz2
Merge branch 'bc/object-id'
Conversion from uchar[40] to struct object_id continues. * bc/object-id: pretty: switch hard-coded constants to the_hash_algo sha1-file: convert constants to uses of the_hash_algo log-tree: switch GIT_SHA1_HEXSZ to the_hash_algo->hexsz diff: switch GIT_SHA1_HEXSZ to use the_hash_algo builtin/merge-recursive: make hash independent builtin/merge: switch to use the_hash_algo builtin/fmt-merge-msg: make hash independent builtin/update-index: simplify parsing of cacheinfo builtin/update-index: convert to using the_hash_algo refs/files-backend: use the_hash_algo for writing refs sha1-name: use the_hash_algo when parsing object names strbuf: allocate space with GIT_MAX_HEXSZ commit: express tree entry constants in terms of the_hash_algo hex: switch to using the_hash_algo tree-walk: replace hard-coded constants with the_hash_algo cache: update object ID functions for the_hash_algo
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/diff.c b/diff.c
index dc53a19..d206146 100644
--- a/diff.c
+++ b/diff.c
@@ -3833,7 +3833,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;
- if (abbrev > GIT_SHA1_HEXSZ)
+ if (abbrev > the_hash_algo->hexsz)
BUG("oid abbreviation out of range: %d", abbrev);
if (abbrev)
hex[abbrev] = '\0';
@@ -4948,7 +4948,7 @@ const char *diff_aligned_abbrev(const struct object_id *oid, int len)
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. */
@@ -4978,7 +4978,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).
*/
- 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, "..");