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/t4102-apply-rename.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 / t4102-apply-rename.sh` 58 lines ยท 1065 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2005 Junio C Hamano 4 # 5 6 test_description='git apply handling copy/rename patch. 7 8 ' 9 10 . ./test-lib.sh 11 12 # setup 13 14 cat >test-patch <<\EOF 15 diff --git a/foo b/bar 16 similarity index 47% 17 rename from foo 18 rename to bar 19 --- a/foo 20 +++ b/bar 21 @@ -1 +1 @@ 22 -This is foo 23 +This is bar 24 EOF 25 26 echo 'This is foo' >foo 27 chmod +x foo 28 29 test_expect_success setup \ 30 'git update-index --add foo' 31 32 test_expect_success apply \ 33 'git apply --index --stat --summary --apply test-patch' 34 35 test_expect_success FILEMODE validate \ 36 'test -f bar && ls -l bar | grep "^-..x......"' 37 38 test_expect_success 'apply reverse' \ 39 'git apply -R --index --stat --summary --apply test-patch && 40 test "$(cat foo)" = "This is foo"' 41 42 cat >test-patch <<\EOF 43 diff --git a/foo b/bar 44 similarity index 47% 45 copy from foo 46 copy to bar 47 --- a/foo 48 +++ b/bar 49 @@ -1 +1 @@ 50 -This is foo 51 +This is bar 52 EOF 53 54 test_expect_success 'apply copy' \ 55 'git apply --index --stat --summary --apply test-patch && 56 test "$(cat bar)" = "This is bar" && test "$(cat foo)" = "This is foo"' 57 58 test_done