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/t4132-apply-removal.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 / t4132-apply-removal.sh` 97 lines ยท 2518 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2009 Junio C Hamano 4 5 test_description='git-apply notices removal patches generated by GNU diff' 6 7 8 . ./test-lib.sh 9 10 test_expect_success setup ' 11 cat <<-EOF >c && 12 diff -ruN a/file b/file 13 --- a/file TS0 14 +++ b/file TS1 15 @@ -0,0 +1 @@ 16 +something 17 EOF 18 19 cat <<-EOF >d && 20 diff -ruN a/file b/file 21 --- a/file TS0 22 +++ b/file TS1 23 @@ -1 +0,0 @@ 24 -something 25 EOF 26 27 timeWest="1982-09-16 07:00:00.`000000000` -0800" && 28 timeGMT="1982-09-16 15:00:00.`000000000` +0000" && 29 timeEast="1982-09-17 00:00:00.`000000000` +0900" && 30 31 epocWest="1969-12-31 16:00:00.`000000000` -0800" && 32 epocGMT="1970-01-01 00:00:00.`000000000` +0000" && 33 epocEast="1970-01-01 09:00:00.`000000000` +0900" && 34 epocWest2="1969-12-31 16:00:00 -08:00" && 35 36 sed -e "s/TS0/$epocWest/" -e "s/TS1/$timeWest/" createWest.patch && 37 sed -e "s/TS0/$epocEast/" -e "s/TS1/$timeEast/" createEast.patch && 38 sed -e "s/TS0/$epocGMT/" -e "s/TS1/$timeGMT/" createGMT.patch && 39 40 sed -e "s/TS0/$timeWest/" -e "s/TS1/$timeWest/" addWest.patch && 41 sed -e "s/TS0/$timeEast/" -e "s/TS1/$timeEast/" addEast.patch && 42 sed -e "s/TS0/$timeGMT/" -e "s/TS1/$timeGMT/" addGMT.patch && 43 44 sed -e "s/TS0/$timeWest/" -e "s/TS1/$timeWest/" emptyWest.patch && 45 sed -e "s/TS0/$timeEast/" -e "s/TS1/$timeEast/" emptyEast.patch && 46 sed -e "s/TS0/$timeGMT/" -e "s/TS1/$timeGMT/" emptyGMT.patch && 47 48 sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest/" removeWest.patch && 49 sed -e "s/TS0/$timeEast/" -e "s/TS1/$epocEast/" removeEast.patch && 50 sed -e "s/TS0/$timeGMT/" -e "s/TS1/$epocGMT/" removeGMT.patch && 51 sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest2/" removeWest2.patch && 52 53 echo something >something 54 ' 55 56 for patch in *.patch 57 do 58 test_expect_success "test $patch" ' 59 rm -f file .git/index && 60 case "$patch" in 61 create*) 62 # must be able to create 63 git apply --index $patch && 64 test_cmp file something && 65 # must notice the file is already there 66 >file && 67 git add file && 68 test_must_fail git apply $patch 69 ;; 70 add*) 71 # must be able to create or patch 72 git apply $patch && 73 test_cmp file something && 74 >file && 75 git apply $patch && 76 test_cmp file something 77 ;; 78 empty*) 79 # must leave an empty file 80 cat something >file && 81 git add file && 82 git apply --index $patch && 83 test -f file && 84 test_must_be_empty file 85 ;; 86 remove*) 87 # must remove the file 88 cat something >file && 89 git add file && 90 git apply --index $patch && 91 ! test -f file 92 ;; 93 esac 94 ' 95 done 96 97 test_done