Git fork

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

+28
+4
diffcore-delta.c
··· 158 158 n = 0; 159 159 accum1 = accum2 = 0; 160 160 } 161 + if (n > 0) { 162 + hashval = (accum1 + accum2 * 0x61) % HASHBASE; 163 + hash = add_spanhash(hash, hashval, n); 164 + } 161 165 QSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp); 162 166 return hash; 163 167 }
+24
t/t4001-diff-rename.sh
··· 286 286 test_cmp expected actual 287 287 ' 288 288 289 + test_expect_success 'last line matters too' ' 290 + { 291 + test_write_lines a 0 1 2 3 4 5 6 7 8 9 && 292 + printf "git ignores final up to 63 characters if not newline terminated" 293 + } >no-final-lf && 294 + git add no-final-lf && 295 + git commit -m "original version of file with no final newline" && 296 + 297 + # Change ONLY the first character of the whole file 298 + { 299 + test_write_lines b 0 1 2 3 4 5 6 7 8 9 && 300 + printf "git ignores final up to 63 characters if not newline terminated" 301 + } >no-final-lf && 302 + git add no-final-lf && 303 + git mv no-final-lf still-absent-final-lf && 304 + git commit -a -m "rename no-final-lf -> still-absent-final-lf" && 305 + git diff-tree -r -M --name-status HEAD^ HEAD >actual && 306 + sed -e "s/^R[0-9]* /R /" actual >actual.munged && 307 + cat >expected <<-\EOF && 308 + R no-final-lf still-absent-final-lf 309 + EOF 310 + test_cmp expected actual.munged 311 + ' 312 + 289 313 test_done