Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t4007-rename-3.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t4007-rename-3.sh` 122 lines ยท 3648 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2005 Junio C Hamano 4 # 5 6 test_description='Rename interaction with pathspec. 7 8 ' 9 10 . ./test-lib.sh 11 . "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash 12 13 test_expect_success 'prepare reference tree' ' 14 mkdir path0 path1 && 15 COPYING_test_data >path0/COPYING && 16 git update-index --add path0/COPYING && 17 tree=$(git write-tree) && 18 blob=$(git rev-parse :path0/COPYING) 19 ' 20 21 test_expect_success 'prepare work tree' ' 22 cp path0/COPYING path1/COPYING && 23 git update-index --add --remove path0/COPYING path1/COPYING 24 ' 25 26 # In the tree, there is only path0/COPYING. In the cache, path0 and 27 # path1 both have COPYING and the latter is a copy of path0/COPYING. 28 # Comparing the full tree with cache should tell us so. 29 30 cat >expected <current && 36 compare_diff_raw current expected 37 ' 38 39 test_expect_success 'copy detection, cached' ' 40 git diff-index -C --find-copies-harder --cached $tree >current && 41 compare_diff_raw current expected 42 ' 43 44 test_expect_success 'exit code of quiet copy detection' ' 45 test_expect_code 1 \ 46 git diff --quiet --cached --find-copies-harder $tree 47 ' 48 49 test_expect_success 'exit code of quiet copy detection with --no-ext-diff' ' 50 test_expect_code 1 \ 51 git diff --quiet --cached --find-copies-harder --no-ext-diff $tree 52 ' 53 54 # In the tree, there is only path0/COPYING. In the cache, path0 and 55 # path1 both have COPYING and the latter is a copy of path0/COPYING. 56 # However when we say we care only about path1, we should just see 57 # path1/COPYING suddenly appearing from nowhere, not detected as 58 # a copy from path0/COPYING. 59 60 cat >expected <current && 66 compare_diff_raw current expected 67 ' 68 69 test_expect_success 'tweak work tree' ' 70 rm -f path0/COPYING 71 ' 72 73 cat >expected <current && 82 compare_diff_raw current expected 83 ' 84 85 test_expect_success 'copy detection, files to preloaded index' ' 86 GIT_TEST_PRELOAD_INDEX=1 \ 87 git diff-files -C --find-copies-harder -R >current && 88 compare_diff_raw current expected 89 ' 90 91 test_expect_success 'tweak index' ' 92 git update-index --remove path0/COPYING 93 ' 94 # In the tree, there is only path0/COPYING. In the cache, path0 does 95 # not have COPYING anymore and path1 has COPYING which is a copy of 96 # path0/COPYING. Showing the full tree with cache should tell us about 97 # the rename. 98 99 cat >expected <current && 105 compare_diff_raw current expected 106 ' 107 108 # In the tree, there is only path0/COPYING. In the cache, path0 does 109 # not have COPYING anymore and path1 has COPYING which is a copy of 110 # path0/COPYING. When we say we care only about path1, we should just 111 # see path1/COPYING appearing from nowhere. 112 113 cat >expected <current && 119 compare_diff_raw current expected 120 ' 121 122 test_done