summaryrefslogtreecommitdiff
path: root/t/t4001-diff-rename.sh
diff options
context:
space:
mode:
authorLibravatar Jiang Xin <worldhello.net@gmail.com>2021-03-04 22:40:13 +0800
committerLibravatar Jiang Xin <worldhello.net@gmail.com>2021-03-04 22:40:13 +0800
commit4dd8469336cc06923acceb3ea4ae02ea00461c5d (patch)
tree92aa9b355242c8904510bb9b61ddfa94b4d1ee47 /t/t4001-diff-rename.sh
parentl10n: tr: v2.31.0-rc0 (diff)
parentGit 2.31-rc1 (diff)
downloadtgif-4dd8469336cc06923acceb3ea4ae02ea00461c5d.tar.xz
Merge branch 'master' of github.com:git/git
* 'master' of github.com:git/git: (63 commits) Git 2.31-rc1 Hopefully the last batch before -rc1 Revert "commit-graph: when incompatible with graphs, indicate why" read-cache: make the index write buffer size 128K dir: fix malloc of root untracked_cache_dir commit-graph.c: display correct number of chunks when writing doc/reftable: document how to handle windows fetch-pack: print and use dangling .gitmodules fetch-pack: with packfile URIs, use index-pack arg http-fetch: allow custom index-pack args http: allow custom index-pack args chunk-format: add technical docs chunk-format: restore duplicate chunk checks midx: use 64-bit multiplication for chunk sizes midx: use chunk-format read API commit-graph: use chunk-format read API chunk-format: create read chunk API midx: use chunk-format API in write_midx_internal() midx: drop chunk progress during write midx: return success/failure in chunk write methods ...
Diffstat (limited to 't/t4001-diff-rename.sh')
-rwxr-xr-xt/t4001-diff-rename.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index 2f9700742a..68f2ebca58 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -262,4 +262,28 @@ test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
grep "myotherfile.*myfile" actual
'
+test_expect_success 'basename similarity vs best similarity' '
+ mkdir subdir &&
+ test_write_lines line1 line2 line3 line4 line5 \
+ line6 line7 line8 line9 line10 >subdir/file.txt &&
+ git add subdir/file.txt &&
+ git commit -m "base txt" &&
+
+ git rm subdir/file.txt &&
+ test_write_lines line1 line2 line3 line4 line5 \
+ line6 line7 line8 >file.txt &&
+ test_write_lines line1 line2 line3 line4 line5 \
+ line6 line7 line8 line9 >file.md &&
+ git add file.txt file.md &&
+ git commit -a -m "rename" &&
+ git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+ # subdir/file.txt is 88% similar to file.md, 78% similar to file.txt,
+ # but since same basenames are checked first...
+ cat >expected <<-\EOF &&
+ A file.md
+ R078 subdir/file.txt file.txt
+ EOF
+ test_cmp expected actual
+'
+
test_done