summaryrefslogtreecommitdiffstats
path: root/diffcore-delta.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-30 01:03:00 +0100
committerJunio C Hamano <gitster@pobox.com>2024-01-30 01:03:00 +0100
commitd3bf8d32d32e628e551a71004f7c6f60d87f1a39 (patch)
treea36a4cab276e7abe4112cfd3e8f29210c749138f /diffcore-delta.c
parentMerge branch 'ps/not-so-many-refs-are-special' (diff)
parentdiffcore-delta: avoid ignoring final 'line' of file (diff)
downloadgit-d3bf8d32d32e628e551a71004f7c6f60d87f1a39.tar.xz
git-d3bf8d32d32e628e551a71004f7c6f60d87f1a39.zip
Merge branch 'en/diffcore-delta-final-line-fix'
Rename detection logic ignored the final line of a file if it is an incomplete line. * en/diffcore-delta-final-line-fix: diffcore-delta: avoid ignoring final 'line' of file
Diffstat (limited to 'diffcore-delta.c')
-rw-r--r--diffcore-delta.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/diffcore-delta.c b/diffcore-delta.c
index 4927ab8fb0..ba6cbee76b 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -158,6 +158,10 @@ static struct spanhash_top *hash_chars(struct repository *r,
n = 0;
accum1 = accum2 = 0;
}
+ if (n > 0) {
+ hashval = (accum1 + accum2 * 0x61) % HASHBASE;
+ hash = add_spanhash(hash, hashval, n);
+ }
QSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp);
return hash;
}