Jason Riedy | 5ab9cc8 | 2007-01-15 17:31:49 -0800 | [diff] [blame] | 1 | #!/bin/sh |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 2 | # |
| 3 | # Copyright (c) Robin Rosenberg |
| 4 | # |
Johan Herland | ab5a423 | 2008-02-13 04:11:22 +0100 | [diff] [blame] | 5 | test_description='Test export of commits to CVS' |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 6 | |
| 7 | . ./test-lib.sh |
| 8 | |
Jeff King | 1b19ccd | 2009-04-03 15:33:59 -0400 | [diff] [blame] | 9 | if ! test_have_prereq PERL; then |
Ævar Arnfjörð Bjarmason | fadb515 | 2010-06-24 17:44:48 +0000 | [diff] [blame] | 10 | skip_all='skipping git cvsexportcommit tests, perl not available' |
Jeff King | 1b19ccd | 2009-04-03 15:33:59 -0400 | [diff] [blame] | 11 | test_done |
| 12 | fi |
| 13 | |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 14 | cvs >/dev/null 2>&1 |
| 15 | if test $? -ne 1 |
| 16 | then |
Ævar Arnfjörð Bjarmason | fadb515 | 2010-06-24 17:44:48 +0000 | [diff] [blame] | 17 | skip_all='skipping git cvsexportcommit tests, cvs not found' |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 18 | test_done |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 19 | fi |
| 20 | |
Ævar Arnfjörð Bjarmason | a78d925 | 2017-02-27 11:26:28 +0000 | [diff] [blame] | 21 | if ! test_have_prereq NOT_ROOT; then |
| 22 | skip_all='When cvs is compiled with CVS_BADROOT commits as root fail' |
| 23 | test_done |
| 24 | fi |
| 25 | |
Torsten Bögershausen | e342acc | 2012-10-26 18:18:24 +0200 | [diff] [blame] | 26 | CVSROOT=$PWD/tmpcvsroot |
Sebastian Schuberth | 4397c65 | 2012-01-11 10:20:14 +0100 | [diff] [blame] | 27 | CVSWORK=$PWD/cvswork |
| 28 | GIT_DIR=$PWD/.git |
Eric Wong | e32139a | 2006-12-28 01:10:52 -0800 | [diff] [blame] | 29 | export CVSROOT CVSWORK GIT_DIR |
| 30 | |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 31 | rm -rf "$CVSROOT" "$CVSWORK" |
Junio C Hamano | 8666df0 | 2012-12-24 17:09:49 -0800 | [diff] [blame] | 32 | |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 33 | cvs init && |
Junio C Hamano | 8666df0 | 2012-12-24 17:09:49 -0800 | [diff] [blame] | 34 | test -d "$CVSROOT" && |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 35 | cvs -Q co -d "$CVSWORK" . && |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 36 | echo >empty && |
| 37 | git add empty && |
Eric Wong | e32139a | 2006-12-28 01:10:52 -0800 | [diff] [blame] | 38 | git commit -q -a -m "Initial" 2>/dev/null || |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 39 | exit 1 |
| 40 | |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 41 | check_entries () { |
| 42 | # $1 == directory, $2 == expected |
John Keeping | 3b1442d | 2016-02-21 17:32:22 +0000 | [diff] [blame] | 43 | sed -ne '/^\//p' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 44 | if test -z "$2" |
| 45 | then |
| 46 | >expected |
| 47 | else |
| 48 | printf '%s\n' "$2" | tr '|' '\012' >expected |
| 49 | fi |
Jeff King | 82ebb0b | 2008-03-12 17:36:36 -0400 | [diff] [blame] | 50 | test_cmp expected actual |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 51 | } |
| 52 | |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 53 | test_expect_success \ |
| 54 | 'New file' \ |
| 55 | 'mkdir A B C D E F && |
| 56 | echo hello1 >A/newfile1.txt && |
| 57 | echo hello2 >B/newfile2.txt && |
Vitaliy Ivanov | b5967f8 | 2011-07-19 20:21:47 +0300 | [diff] [blame] | 58 | cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png && |
| 59 | cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png && |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 60 | git add A/newfile1.txt && |
| 61 | git add B/newfile2.txt && |
| 62 | git add C/newfile3.png && |
| 63 | git add D/newfile4.png && |
| 64 | git commit -a -m "Test: New file" && |
| 65 | id=$(git rev-list --max-count=1 HEAD) && |
| 66 | (cd "$CVSWORK" && |
| 67 | git cvsexportcommit -c $id && |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 68 | check_entries A "newfile1.txt/1.1/" && |
| 69 | check_entries B "newfile2.txt/1.1/" && |
| 70 | check_entries C "newfile3.png/1.1/-kb" && |
| 71 | check_entries D "newfile4.png/1.1/-kb" && |
Gary V. Vaughan | 4fdf71b | 2010-05-14 09:31:37 +0000 | [diff] [blame] | 72 | test_cmp A/newfile1.txt ../A/newfile1.txt && |
| 73 | test_cmp B/newfile2.txt ../B/newfile2.txt && |
| 74 | test_cmp C/newfile3.png ../C/newfile3.png && |
| 75 | test_cmp D/newfile4.png ../D/newfile4.png |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 76 | )' |
| 77 | |
| 78 | test_expect_success \ |
| 79 | 'Remove two files, add two and update two' \ |
| 80 | 'echo Hello1 >>A/newfile1.txt && |
| 81 | rm -f B/newfile2.txt && |
| 82 | rm -f C/newfile3.png && |
| 83 | echo Hello5 >E/newfile5.txt && |
Vitaliy Ivanov | b5967f8 | 2011-07-19 20:21:47 +0300 | [diff] [blame] | 84 | cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png && |
| 85 | cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png && |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 86 | git add E/newfile5.txt && |
| 87 | git add F/newfile6.png && |
| 88 | git commit -a -m "Test: Remove, add and update" && |
| 89 | id=$(git rev-list --max-count=1 HEAD) && |
| 90 | (cd "$CVSWORK" && |
| 91 | git cvsexportcommit -c $id && |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 92 | check_entries A "newfile1.txt/1.2/" && |
| 93 | check_entries B "" && |
| 94 | check_entries C "" && |
| 95 | check_entries D "newfile4.png/1.2/-kb" && |
| 96 | check_entries E "newfile5.txt/1.1/" && |
| 97 | check_entries F "newfile6.png/1.1/-kb" && |
Gary V. Vaughan | 4fdf71b | 2010-05-14 09:31:37 +0000 | [diff] [blame] | 98 | test_cmp A/newfile1.txt ../A/newfile1.txt && |
| 99 | test_cmp D/newfile4.png ../D/newfile4.png && |
| 100 | test_cmp E/newfile5.txt ../E/newfile5.txt && |
| 101 | test_cmp F/newfile6.png ../F/newfile6.png |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 102 | )' |
| 103 | |
Nanako Shiraishi | 5190d73 | 2008-09-10 06:25:24 +0900 | [diff] [blame] | 104 | # Should fail (but only on the git cvsexportcommit stage) |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 105 | test_expect_success \ |
| 106 | 'Fail to change binary more than one generation old' \ |
| 107 | 'cat F/newfile6.png >>D/newfile4.png && |
| 108 | git commit -a -m "generatiion 1" && |
| 109 | cat F/newfile6.png >>D/newfile4.png && |
| 110 | git commit -a -m "generation 2" && |
| 111 | id=$(git rev-list --max-count=1 HEAD) && |
| 112 | (cd "$CVSWORK" && |
Stephan Beyer | d492b31 | 2008-07-12 17:47:52 +0200 | [diff] [blame] | 113 | test_must_fail git cvsexportcommit -c $id |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 114 | )' |
| 115 | |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 116 | #test_expect_success \ |
| 117 | # 'Fail to remove binary file more than one generation old' \ |
| 118 | # 'git reset --hard HEAD^ && |
| 119 | # cat F/newfile6.png >>D/newfile4.png && |
| 120 | # git commit -a -m "generation 2 (again)" && |
| 121 | # rm -f D/newfile4.png && |
| 122 | # git commit -a -m "generation 3" && |
| 123 | # id=$(git rev-list --max-count=1 HEAD) && |
| 124 | # (cd "$CVSWORK" && |
Stephan Beyer | d492b31 | 2008-07-12 17:47:52 +0200 | [diff] [blame] | 125 | # test_must_fail git cvsexportcommit -c $id |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 126 | # )' |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 127 | |
| 128 | # We reuse the state from two tests back here |
| 129 | |
| 130 | # This test is here because a patch for only binary files will |
| 131 | # fail with gnu patch, so cvsexportcommit must handle that. |
| 132 | test_expect_success \ |
| 133 | 'Remove only binary files' \ |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 134 | 'git reset --hard HEAD^^ && |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 135 | rm -f D/newfile4.png && |
| 136 | git commit -a -m "test: remove only a binary file" && |
| 137 | id=$(git rev-list --max-count=1 HEAD) && |
| 138 | (cd "$CVSWORK" && |
| 139 | git cvsexportcommit -c $id && |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 140 | check_entries A "newfile1.txt/1.2/" && |
| 141 | check_entries B "" && |
| 142 | check_entries C "" && |
| 143 | check_entries D "" && |
| 144 | check_entries E "newfile5.txt/1.1/" && |
| 145 | check_entries F "newfile6.png/1.1/-kb" && |
Gary V. Vaughan | 4fdf71b | 2010-05-14 09:31:37 +0000 | [diff] [blame] | 146 | test_cmp A/newfile1.txt ../A/newfile1.txt && |
| 147 | test_cmp E/newfile5.txt ../E/newfile5.txt && |
| 148 | test_cmp F/newfile6.png ../F/newfile6.png |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 149 | )' |
| 150 | |
| 151 | test_expect_success \ |
| 152 | 'Remove only a text file' \ |
| 153 | 'rm -f A/newfile1.txt && |
| 154 | git commit -a -m "test: remove only a binary file" && |
| 155 | id=$(git rev-list --max-count=1 HEAD) && |
| 156 | (cd "$CVSWORK" && |
| 157 | git cvsexportcommit -c $id && |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 158 | check_entries A "" && |
| 159 | check_entries B "" && |
| 160 | check_entries C "" && |
| 161 | check_entries D "" && |
| 162 | check_entries E "newfile5.txt/1.1/" && |
| 163 | check_entries F "newfile6.png/1.1/-kb" && |
Gary V. Vaughan | 4fdf71b | 2010-05-14 09:31:37 +0000 | [diff] [blame] | 164 | test_cmp E/newfile5.txt ../E/newfile5.txt && |
| 165 | test_cmp F/newfile6.png ../F/newfile6.png |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 166 | )' |
| 167 | |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 168 | test_expect_success \ |
| 169 | 'New file with spaces in file name' \ |
| 170 | 'mkdir "G g" && |
| 171 | echo ok then >"G g/with spaces.txt" && |
| 172 | git add "G g/with spaces.txt" && \ |
Vitaliy Ivanov | b5967f8 | 2011-07-19 20:21:47 +0300 | [diff] [blame] | 173 | cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \ |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 174 | git add "G g/with spaces.png" && |
| 175 | git commit -a -m "With spaces" && |
| 176 | id=$(git rev-list --max-count=1 HEAD) && |
| 177 | (cd "$CVSWORK" && |
Nanako Shiraishi | 5190d73 | 2008-09-10 06:25:24 +0900 | [diff] [blame] | 178 | git cvsexportcommit -c $id && |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 179 | check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/" |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 180 | )' |
| 181 | |
| 182 | test_expect_success \ |
| 183 | 'Update file with spaces in file name' \ |
| 184 | 'echo Ok then >>"G g/with spaces.txt" && |
Vitaliy Ivanov | b5967f8 | 2011-07-19 20:21:47 +0300 | [diff] [blame] | 185 | cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \ |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 186 | git add "G g/with spaces.png" && |
| 187 | git commit -a -m "Update with spaces" && |
| 188 | id=$(git rev-list --max-count=1 HEAD) && |
| 189 | (cd "$CVSWORK" && |
Nanako Shiraishi | 5190d73 | 2008-09-10 06:25:24 +0900 | [diff] [blame] | 190 | git cvsexportcommit -c $id |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 191 | check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/" |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 192 | )' |
| 193 | |
Junio C Hamano | 133f081 | 2007-02-04 17:30:58 -0800 | [diff] [blame] | 194 | # Some filesystems mangle pathnames with UTF-8 characters -- |
| 195 | # check and skip |
| 196 | if p="Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" && |
| 197 | mkdir -p "tst/$p" && |
| 198 | date >"tst/$p/day" && |
| 199 | found=$(find tst -type f -print) && |
| 200 | test "z$found" = "ztst/$p/day" && |
| 201 | rm -fr tst |
| 202 | then |
| 203 | |
Junio C Hamano | 1a91ebf | 2007-01-31 14:21:48 -0800 | [diff] [blame] | 204 | # This test contains UTF-8 characters |
Johannes Schindelin | 4539a89 | 2016-01-27 17:20:26 +0100 | [diff] [blame] | 205 | test_expect_success !MINGW \ |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 206 | 'File with non-ascii file name' \ |
Junio C Hamano | 1a91ebf | 2007-01-31 14:21:48 -0800 | [diff] [blame] | 207 | 'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö && |
| 208 | echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt && |
| 209 | git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt && |
Vitaliy Ivanov | b5967f8 | 2011-07-19 20:21:47 +0300 | [diff] [blame] | 210 | cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png && |
Junio C Hamano | 1a91ebf | 2007-01-31 14:21:48 -0800 | [diff] [blame] | 211 | git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png && |
| 212 | git commit -a -m "Går det så går det" && \ |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 213 | id=$(git rev-list --max-count=1 HEAD) && |
| 214 | (cd "$CVSWORK" && |
Nanako Shiraishi | 5190d73 | 2008-09-10 06:25:24 +0900 | [diff] [blame] | 215 | git cvsexportcommit -v -c $id && |
Junio C Hamano | c4eaed4 | 2007-07-24 23:25:38 -0700 | [diff] [blame] | 216 | check_entries \ |
| 217 | "Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" \ |
| 218 | "gårdetsågårdet.png/1.1/-kb|gårdetsågårdet.txt/1.1/" |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 219 | )' |
| 220 | |
Junio C Hamano | 133f081 | 2007-02-04 17:30:58 -0800 | [diff] [blame] | 221 | fi |
| 222 | |
| 223 | rm -fr tst |
| 224 | |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 225 | test_expect_success \ |
| 226 | 'Mismatching patch should fail' \ |
| 227 | 'date >>"E/newfile5.txt" && |
| 228 | git add "E/newfile5.txt" && |
| 229 | git commit -a -m "Update one" && |
| 230 | date >>"E/newfile5.txt" && |
| 231 | git add "E/newfile5.txt" && |
| 232 | git commit -a -m "Update two" && |
| 233 | id=$(git rev-list --max-count=1 HEAD) && |
| 234 | (cd "$CVSWORK" && |
Nanako Shiraishi | 5190d73 | 2008-09-10 06:25:24 +0900 | [diff] [blame] | 235 | test_must_fail git cvsexportcommit -c $id |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 236 | )' |
| 237 | |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 238 | test_expect_success FILEMODE \ |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 239 | 'Retain execute bit' \ |
| 240 | 'mkdir G && |
| 241 | echo executeon >G/on && |
| 242 | chmod +x G/on && |
| 243 | echo executeoff >G/off && |
| 244 | git add G/on && |
| 245 | git add G/off && |
| 246 | git commit -a -m "Execute test" && |
| 247 | (cd "$CVSWORK" && |
Nanako Shiraishi | 5190d73 | 2008-09-10 06:25:24 +0900 | [diff] [blame] | 248 | git cvsexportcommit -c HEAD |
Robin Rosenberg | e86ad71 | 2006-12-11 00:30:06 +0100 | [diff] [blame] | 249 | test -x G/on && |
| 250 | ! test -x G/off |
| 251 | )' |
Jim Meyering | 7c0f702 | 2006-12-04 08:44:08 +0100 | [diff] [blame] | 252 | |
Johan Herland | a723759 | 2008-02-12 00:43:41 +0100 | [diff] [blame] | 253 | test_expect_success '-w option should work with relative GIT_DIR' ' |
Johan Herland | ab5a423 | 2008-02-13 04:11:22 +0100 | [diff] [blame] | 254 | mkdir W && |
| 255 | echo foobar >W/file1.txt && |
| 256 | echo bazzle >W/file2.txt && |
| 257 | git add W/file1.txt && |
| 258 | git add W/file2.txt && |
| 259 | git commit -m "More updates" && |
| 260 | id=$(git rev-list --max-count=1 HEAD) && |
| 261 | (cd "$GIT_DIR" && |
| 262 | GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id && |
| 263 | check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" && |
Jeff King | 82ebb0b | 2008-03-12 17:36:36 -0400 | [diff] [blame] | 264 | test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt && |
| 265 | test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt |
Johan Herland | ab5a423 | 2008-02-13 04:11:22 +0100 | [diff] [blame] | 266 | ) |
| 267 | ' |
| 268 | |
Johannes Schindelin | fef3a7c | 2008-02-18 17:55:22 +0000 | [diff] [blame] | 269 | test_expect_success 'check files before directories' ' |
| 270 | |
| 271 | echo Notes > release-notes && |
| 272 | git add release-notes && |
| 273 | git commit -m "Add release notes" release-notes && |
| 274 | id=$(git rev-parse HEAD) && |
| 275 | git cvsexportcommit -w "$CVSWORK" -c $id && |
| 276 | |
| 277 | echo new > DS && |
| 278 | echo new > E/DS && |
| 279 | echo modified > release-notes && |
| 280 | git add DS E/DS release-notes && |
| 281 | git commit -m "Add two files with the same basename" && |
| 282 | id=$(git rev-parse HEAD) && |
| 283 | git cvsexportcommit -w "$CVSWORK" -c $id && |
| 284 | check_entries "$CVSWORK/E" "DS/1.1/|newfile5.txt/1.1/" && |
| 285 | check_entries "$CVSWORK" "DS/1.1/|release-notes/1.2/" && |
Jeff King | 82ebb0b | 2008-03-12 17:36:36 -0400 | [diff] [blame] | 286 | test_cmp "$CVSWORK/DS" DS && |
| 287 | test_cmp "$CVSWORK/E/DS" E/DS && |
| 288 | test_cmp "$CVSWORK/release-notes" release-notes |
Johannes Schindelin | fef3a7c | 2008-02-18 17:55:22 +0000 | [diff] [blame] | 289 | |
| 290 | ' |
| 291 | |
Mike Ralphson | 3de4a44 | 2009-07-15 15:34:24 +0100 | [diff] [blame] | 292 | test_expect_success 're-commit a removed filename which remains in CVS attic' ' |
| 293 | |
| 294 | (cd "$CVSWORK" && |
| 295 | echo >attic_gremlin && |
| 296 | cvs -Q add attic_gremlin && |
| 297 | cvs -Q ci -m "added attic_gremlin" && |
| 298 | rm attic_gremlin && |
| 299 | cvs -Q rm attic_gremlin && |
| 300 | cvs -Q ci -m "removed attic_gremlin") && |
| 301 | |
| 302 | echo > attic_gremlin && |
| 303 | git add attic_gremlin && |
| 304 | git commit -m "Added attic_gremlin" && |
| 305 | git cvsexportcommit -w "$CVSWORK" -c HEAD && |
| 306 | (cd "$CVSWORK"; cvs -Q update -d) && |
| 307 | test -f "$CVSWORK/attic_gremlin" |
| 308 | ' |
| 309 | |
| 310 | # the state of the CVS sandbox may be indeterminate for ' space' |
| 311 | # after this test on some platforms / with some versions of CVS |
| 312 | # consider adding new tests above this point |
Johannes Schindelin | fef3a7c | 2008-02-18 17:55:22 +0000 | [diff] [blame] | 313 | test_expect_success 'commit a file with leading spaces in the name' ' |
| 314 | |
| 315 | echo space > " space" && |
| 316 | git add " space" && |
| 317 | git commit -m "Add a file with a leading space" && |
| 318 | id=$(git rev-parse HEAD) && |
| 319 | git cvsexportcommit -w "$CVSWORK" -c $id && |
Mike Ralphson | 3de4a44 | 2009-07-15 15:34:24 +0100 | [diff] [blame] | 320 | check_entries "$CVSWORK" " space/1.1/|DS/1.1/|attic_gremlin/1.3/|release-notes/1.2/" && |
Jeff King | 82ebb0b | 2008-03-12 17:36:36 -0400 | [diff] [blame] | 321 | test_cmp "$CVSWORK/ space" " space" |
Johannes Schindelin | fef3a7c | 2008-02-18 17:55:22 +0000 | [diff] [blame] | 322 | |
| 323 | ' |
| 324 | |
Johannes Schindelin | d775734 | 2008-05-14 15:29:49 +0100 | [diff] [blame] | 325 | test_expect_success 'use the same checkout for Git and CVS' ' |
| 326 | |
| 327 | (mkdir shared && |
| 328 | cd shared && |
Ævar Arnfjörð Bjarmason | 1f5ad6b | 2012-02-12 01:05:12 +0000 | [diff] [blame] | 329 | sane_unset GIT_DIR && |
Johannes Schindelin | d775734 | 2008-05-14 15:29:49 +0100 | [diff] [blame] | 330 | cvs co . && |
| 331 | git init && |
| 332 | git add " space" && |
| 333 | git commit -m "fake initial commit" && |
| 334 | echo Hello >> " space" && |
| 335 | git commit -m "Another change" " space" && |
| 336 | git cvsexportcommit -W -p -u -c HEAD && |
| 337 | grep Hello " space" && |
| 338 | git diff-files) |
| 339 | |
| 340 | ' |
| 341 | |
Robin Rosenberg | fe142b3 | 2006-11-12 16:29:42 +0100 | [diff] [blame] | 342 | test_done |