* [PATCH 0/7] Modernize t9300-fast-import
@ 2015-11-19 19:09 Johannes Sixt
2015-11-19 19:09 ` [PATCH 1/7] modernize t9300: single-quote placement and indentation Johannes Sixt
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
Some time ago, I had to dig into t9300-fast-import and found it quite
unhelpful that it does not follow our modern best-practices. This series
brings it up-to-date. I thought I submit it now while it is quiet in
the area.
The larger patches are best viewed using -w -color-words because the
regular patch text is ... overwhelming.
Improving shell coding style is outside the scope of this series. I mean
fixing eyesores such as 'cat >foo <<EOF && cat foo | sort > bar', or minor
things such as quoting <<\EOF when the here-doc does not require
substitutions.
In case the large patches don't make it to the list, the series is also
available from
https://github.com/j6t/git.git modernize-t9300
Johannes Sixt (7):
modernize t9300: single-quote placement and indentation
modernize t9300: use test_must_fail
modernize t9300: use test_must_be_empty
modernize t9300: wrap lines after &&
modernize t9300: use test_when_finished for clean-up
modernize t9300: mark here-doc words to ignore tab indentation
modernize t9300: move test preparations into test_expect_success
t/t9300-fast-import.sh | 3629 ++++++++++++++++++++++++------------------------
1 file changed, 1822 insertions(+), 1807 deletions(-)
--
2.6.2.337.ga235d84
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/7] modernize t9300: single-quote placement and indentation
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
@ 2015-11-19 19:09 ` Johannes Sixt
2015-11-19 19:09 ` [PATCH 2/7] modernize t9300: use test_must_fail Johannes Sixt
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
Many test cases do not follow our modern style that places the
single-quotes that surround the shell code snippets before and after
the shell code. Make it so.
Many of the lines changed in this way are indented other than by a
single tab. Change them (and some additional lines) to be indented
with a tab.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9300-fast-import.sh | 872 +++++++++++++++++++++++++------------------------
1 file changed, 437 insertions(+), 435 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 9984c48..566f7bd 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -100,10 +100,10 @@ An annotated tag that annotates a blob.
EOF
INPUT_END
-test_expect_success \
- 'A: create pack from stdin' \
- 'git fast-import --export-marks=marks.out <input &&
- git whatchanged master'
+test_expect_success 'A: create pack from stdin' '
+ git fast-import --export-marks=marks.out <input &&
+ git whatchanged master
+'
test_expect_success 'A: verify pack' '
verify_packs
@@ -115,35 +115,35 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
initial
EOF
-test_expect_success \
- 'A: verify commit' \
- 'git cat-file commit master | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'A: verify commit' '
+ git cat-file commit master | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect <<EOF
100644 blob file2
100644 blob file3
100755 blob file4
EOF
-test_expect_success \
- 'A: verify tree' \
- 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
- test_cmp expect actual'
+test_expect_success 'A: verify tree' '
+ git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
+ test_cmp expect actual
+'
echo "$file2_data" >expect
-test_expect_success \
- 'A: verify file2' \
- 'git cat-file blob master:file2 >actual && test_cmp expect actual'
+test_expect_success 'A: verify file2' '
+ git cat-file blob master:file2 >actual && test_cmp expect actual
+'
echo "$file3_data" >expect
-test_expect_success \
- 'A: verify file3' \
- 'git cat-file blob master:file3 >actual && test_cmp expect actual'
+test_expect_success 'A: verify file3' '
+ git cat-file blob master:file3 >actual && test_cmp expect actual
+'
printf "$file4_data" >expect
-test_expect_success \
- 'A: verify file4' \
- 'git cat-file blob master:file4 >actual && test_cmp expect actual'
+test_expect_success 'A: verify file4' '
+ git cat-file blob master:file4 >actual && test_cmp expect actual
+'
cat >expect <<EOF
object $(git rev-parse refs/heads/master)
@@ -175,17 +175,17 @@ cat >expect <<EOF
:4 `git rev-parse --verify master:file4`
:5 `git rev-parse --verify master^0`
EOF
-test_expect_success \
- 'A: verify marks output' \
- 'test_cmp expect marks.out'
+test_expect_success 'A: verify marks output' '
+ test_cmp expect marks.out
+'
-test_expect_success \
- 'A: verify marks import' \
- 'git fast-import \
+test_expect_success 'A: verify marks import' '
+ git fast-import \
--import-marks=marks.out \
--export-marks=marks.new \
</dev/null &&
- test_cmp expect marks.new'
+ test_cmp expect marks.new
+'
test_tick
new_blob=$(echo testing | git hash-object --stdin)
@@ -229,12 +229,12 @@ tag series-A-blob-3
Tag new_blob.
EOF
-test_expect_success \
- 'A: tag blob by sha1' \
- 'git fast-import <input &&
+test_expect_success 'A: tag blob by sha1' '
+ git fast-import <input &&
git cat-file tag tags/series-A-blob-2 >actual &&
git cat-file tag tags/series-A-blob-3 >>actual &&
- test_cmp expect actual'
+ test_cmp expect actual
+'
test_tick
cat >input <<INPUT_END
@@ -248,10 +248,10 @@ from :5
M 755 :2 copy-of-file2
INPUT_END
-test_expect_success \
- 'A: verify marks import does not crash' \
- 'git fast-import --import-marks=marks.out <input &&
- git whatchanged verify--import-marks'
+test_expect_success 'A: verify marks import does not crash' '
+ git fast-import --import-marks=marks.out <input &&
+ git whatchanged verify--import-marks
+'
test_expect_success 'A: verify pack' '
verify_packs
@@ -261,11 +261,11 @@ cat >expect <<EOF
:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
EOF
git diff-tree -M -r master verify--import-marks >actual
-test_expect_success \
- 'A: verify diff' \
- 'compare_diff_raw expect actual &&
- test `git rev-parse --verify master:file2` \
- = `git rev-parse --verify verify--import-marks:copy-of-file2`'
+test_expect_success 'A: verify diff' '
+ compare_diff_raw expect actual &&
+ test `git rev-parse --verify master:file2` \
+ = `git rev-parse --verify verify--import-marks:copy-of-file2`
+'
test_tick
mt=$(git hash-object --stdin < /dev/null)
@@ -322,7 +322,8 @@ test_expect_success 'A: export marks with large values' '
cat input.blob input.commit | git fast-import --export-marks=marks.large &&
git ls-tree refs/heads/verify--dump-marks >tree.out &&
test_cmp tree.exp_s tree.out &&
- test_cmp marks.exp marks.large'
+ test_cmp marks.exp marks.large
+'
###
### series B
@@ -342,7 +343,7 @@ M 755 0000000000000000000000000000000000000001 zero1
INPUT_END
test_expect_success 'B: fail on invalid blob sha1' '
- test_must_fail git fast-import <input
+ test_must_fail git fast-import <input
'
rm -f .git/objects/pack_* .git/objects/index_*
@@ -356,11 +357,11 @@ COMMIT
from refs/heads/master
INPUT_END
-test_expect_success \
- 'B: accept branch name "TEMP_TAG"' \
- 'git fast-import <input &&
- test -f .git/TEMP_TAG &&
- test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
+test_expect_success 'B: accept branch name "TEMP_TAG"' '
+ git fast-import <input &&
+ test -f .git/TEMP_TAG &&
+ test `git rev-parse master` = `git rev-parse TEMP_TAG^`
+'
rm -f .git/TEMP_TAG
git gc 2>/dev/null >/dev/null
@@ -482,19 +483,19 @@ M 755 $newf file2/newf
D file3
INPUT_END
-test_expect_success \
- 'C: incremental import create pack from stdin' \
- 'git fast-import <input &&
- git whatchanged branch'
+test_expect_success 'C: incremental import create pack from stdin' '
+ git fast-import <input &&
+ git whatchanged branch
+'
test_expect_success 'C: verify pack' '
verify_packs
'
-test_expect_success \
- 'C: validate reuse existing blob' \
- 'test $newf = `git rev-parse --verify branch:file2/newf` &&
- test $oldf = `git rev-parse --verify branch:file2/oldf`'
+test_expect_success 'C: validate reuse existing blob' '
+ test $newf = `git rev-parse --verify branch:file2/newf` &&
+ test $oldf = `git rev-parse --verify branch:file2/oldf`
+'
cat >expect <<EOF
parent `git rev-parse --verify master^0`
@@ -503,10 +504,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
second
EOF
-test_expect_success \
- 'C: verify commit' \
- 'git cat-file commit branch | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'C: verify commit' '
+ git cat-file commit branch | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect <<EOF
:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
@@ -514,9 +515,9 @@ cat >expect <<EOF
:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
EOF
git diff-tree -M -r master branch >actual
-test_expect_success \
- 'C: validate rename result' \
- 'compare_diff_raw expect actual'
+test_expect_success 'C: validate rename result' '
+ compare_diff_raw expect actual
+'
###
### series D
@@ -542,10 +543,10 @@ $file6_data
EOF
INPUT_END
-test_expect_success \
- 'D: inline data in commit' \
- 'git fast-import <input &&
- git whatchanged branch'
+test_expect_success 'D: inline data in commit' '
+ git fast-import <input &&
+ git whatchanged branch
+'
test_expect_success 'D: verify pack' '
verify_packs
@@ -556,21 +557,21 @@ cat >expect <<EOF
:000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
EOF
git diff-tree -M -r branch^ branch >actual
-test_expect_success \
- 'D: validate new files added' \
- 'compare_diff_raw expect actual'
+test_expect_success 'D: validate new files added' '
+ compare_diff_raw expect actual
+'
echo "$file5_data" >expect
-test_expect_success \
- 'D: verify file5' \
- 'git cat-file blob branch:newdir/interesting >actual &&
- test_cmp expect actual'
+test_expect_success 'D: verify file5' '
+ git cat-file blob branch:newdir/interesting >actual &&
+ test_cmp expect actual
+'
echo "$file6_data" >expect
-test_expect_success \
- 'D: verify file6' \
- 'git cat-file blob branch:newdir/exec.sh >actual &&
- test_cmp expect actual'
+test_expect_success 'D: verify file6' '
+ git cat-file blob branch:newdir/exec.sh >actual &&
+ test_cmp expect actual
+'
###
### series E
@@ -588,11 +589,11 @@ from refs/heads/branch^0
INPUT_END
test_expect_success 'E: rfc2822 date, --date-format=raw' '
- test_must_fail git fast-import --date-format=raw <input
+ test_must_fail git fast-import --date-format=raw <input
+'
+test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '
+ git fast-import --date-format=rfc2822 <input
'
-test_expect_success \
- 'E: rfc2822 date, --date-format=rfc2822' \
- 'git fast-import --date-format=rfc2822 <input'
test_expect_success 'E: verify pack' '
verify_packs
@@ -604,10 +605,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
RFC 2822 type date
EOF
-test_expect_success \
- 'E: verify commit' \
- 'git cat-file commit branch | sed 1,2d >actual &&
- test_cmp expect actual'
+test_expect_success 'E: verify commit' '
+ git cat-file commit branch | sed 1,2d >actual &&
+ test_cmp expect actual
+'
###
### series F
@@ -628,13 +629,12 @@ reset refs/heads/other
from refs/heads/branch
INPUT_END
-test_expect_success \
- 'F: non-fast-forward update skips' \
- 'if git fast-import <input
- then
+test_expect_success 'F: non-fast-forward update skips' '
+ if git fast-import <input
+ then
echo BAD gfi did not fail
return 1
- else
+ else
if test $old_branch = `git rev-parse --verify branch^0`
then
: branch unaffected and failure returned
@@ -643,8 +643,8 @@ test_expect_success \
echo BAD gfi changed branch $old_branch
return 1
fi
- fi
- '
+ fi
+'
test_expect_success 'F: verify pack' '
verify_packs
@@ -658,10 +658,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
losing things already?
EOF
-test_expect_success \
- 'F: verify other commit' \
- 'git cat-file commit other >actual &&
- test_cmp expect actual'
+test_expect_success 'F: verify other commit' '
+ git cat-file commit other >actual &&
+ test_cmp expect actual
+'
###
### series G
@@ -679,18 +679,18 @@ COMMIT
from refs/heads/branch~1
INPUT_END
-test_expect_success \
- 'G: non-fast-forward update forced' \
- 'git fast-import --force <input'
+test_expect_success 'G: non-fast-forward update forced' '
+ git fast-import --force <input
+'
test_expect_success 'G: verify pack' '
verify_packs
'
-test_expect_success \
- 'G: branch changed, but logged' \
- 'test $old_branch != `git rev-parse --verify branch^0` &&
- test $old_branch = `git rev-parse --verify branch@{1}`'
+test_expect_success 'G: branch changed, but logged' '
+ test $old_branch != `git rev-parse --verify branch^0` &&
+ test $old_branch = `git rev-parse --verify branch@{1}`
+'
###
### series H
@@ -717,10 +717,10 @@ $file5_data
EOF
INPUT_END
-test_expect_success \
- 'H: deletall, add 1' \
- 'git fast-import <input &&
- git whatchanged H'
+test_expect_success 'H: deletall, add 1' '
+ git fast-import <input &&
+ git whatchanged H
+'
test_expect_success 'H: verify pack' '
verify_packs
@@ -734,15 +734,15 @@ cat >expect <<EOF
:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
EOF
git diff-tree -M -r H^ H >actual
-test_expect_success \
- 'H: validate old files removed, new files added' \
- 'compare_diff_raw expect actual'
+test_expect_success 'H: validate old files removed, new files added' '
+ compare_diff_raw expect actual
+'
echo "$file5_data" >expect
-test_expect_success \
- 'H: verify file' \
- 'git cat-file blob H:h/e/l/lo >actual &&
- test_cmp expect actual'
+test_expect_success 'H: verify file' '
+ git cat-file blob H:h/e/l/lo >actual &&
+ test_cmp expect actual
+'
###
### series I
@@ -758,17 +758,17 @@ COMMIT
from refs/heads/branch
INPUT_END
-test_expect_success \
- 'I: export-pack-edges' \
- 'git fast-import --export-pack-edges=edges.list <input'
+test_expect_success 'I: export-pack-edges' '
+ git fast-import --export-pack-edges=edges.list <input
+'
cat >expect <<EOF
.git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
EOF
-test_expect_success \
- 'I: verify edge list' \
- 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
- test_cmp expect actual'
+test_expect_success 'I: verify edge list' '
+ sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
+ test_cmp expect actual
+'
###
### series J
@@ -792,13 +792,13 @@ initialize J
COMMIT
INPUT_END
-test_expect_success \
- 'J: reset existing branch creates empty commit' \
- 'git fast-import <input'
-test_expect_success \
- 'J: branch has 1 commit, empty tree' \
- 'test 1 = `git rev-list J | wc -l` &&
- test 0 = `git ls-tree J | wc -l`'
+test_expect_success 'J: reset existing branch creates empty commit' '
+ git fast-import <input
+'
+test_expect_success 'J: branch has 1 commit, empty tree' '
+ test 1 = `git rev-list J | wc -l` &&
+ test 0 = `git ls-tree J | wc -l`
+'
cat >input <<INPUT_END
reset refs/heads/J2
@@ -809,9 +809,9 @@ data <<EOF
Tag branch that was reset.
EOF
INPUT_END
-test_expect_success \
- 'J: tag must fail on empty branch' \
- 'test_must_fail git fast-import <input'
+test_expect_success 'J: tag must fail on empty branch' '
+ test_must_fail git fast-import <input
+'
###
### series K
###
@@ -834,13 +834,13 @@ COMMIT
from refs/heads/branch^1
INPUT_END
-test_expect_success \
- 'K: reinit branch with from' \
- 'git fast-import <input'
-test_expect_success \
- 'K: verify K^1 = branch^1' \
- 'test `git rev-parse --verify branch^1` \
- = `git rev-parse --verify K^1`'
+test_expect_success 'K: reinit branch with from' '
+ git fast-import <input
+'
+test_expect_success 'K: verify K^1 = branch^1' '
+ test `git rev-parse --verify branch^1` \
+ = `git rev-parse --verify K^1`
+'
###
### series L
@@ -886,11 +886,11 @@ cat >expect <<EXPECT_END
:100644 100644 4268632... 55d3a52... M ba
EXPECT_END
-test_expect_success \
- 'L: verify internal tree sorting' \
- 'git fast-import <input &&
- git diff-tree --abbrev --raw L^ L >output &&
- test_cmp expect output'
+test_expect_success 'L: verify internal tree sorting' '
+ git fast-import <input &&
+ git diff-tree --abbrev --raw L^ L >output &&
+ test_cmp expect output
+'
cat >input <<INPUT_END
blob
@@ -923,13 +923,13 @@ g/b/f
g/b/h
EOF
-test_expect_success \
- 'L: nested tree copy does not corrupt deltas' \
- 'git fast-import <input &&
+test_expect_success 'L: nested tree copy does not corrupt deltas' '
+ git fast-import <input &&
git ls-tree L2 g/b/ >tmp &&
cat tmp | cut -f 2 >actual &&
test_cmp expect actual &&
- git fsck `git rev-parse L2`'
+ git fsck `git rev-parse L2`
+'
git update-ref -d refs/heads/L2
@@ -953,11 +953,11 @@ INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
EOF
-test_expect_success \
- 'M: rename file in same subdirectory' \
- 'git fast-import <input &&
- git diff-tree -M -r M1^ M1 >actual &&
- compare_diff_raw expect actual'
+test_expect_success 'M: rename file in same subdirectory' '
+ git fast-import <input &&
+ git diff-tree -M -r M1^ M1 >actual &&
+ compare_diff_raw expect actual
+'
cat >input <<INPUT_END
commit refs/heads/M2
@@ -974,11 +974,11 @@ INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
EOF
-test_expect_success \
- 'M: rename file to new subdirectory' \
- 'git fast-import <input &&
- git diff-tree -M -r M2^ M2 >actual &&
- compare_diff_raw expect actual'
+test_expect_success 'M: rename file to new subdirectory' '
+ git fast-import <input &&
+ git diff-tree -M -r M2^ M2 >actual &&
+ compare_diff_raw expect actual
+'
cat >input <<INPUT_END
commit refs/heads/M3
@@ -995,11 +995,11 @@ INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
EOF
-test_expect_success \
- 'M: rename subdirectory to new subdirectory' \
- 'git fast-import <input &&
- git diff-tree -M -r M3^ M3 >actual &&
- compare_diff_raw expect actual'
+test_expect_success 'M: rename subdirectory to new subdirectory' '
+ git fast-import <input &&
+ git diff-tree -M -r M3^ M3 >actual &&
+ compare_diff_raw expect actual
+'
cat >input <<INPUT_END
commit refs/heads/M4
@@ -1020,12 +1020,12 @@ cat >expect <<EOF
:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
EOF
-test_expect_success \
- 'M: rename root to subdirectory' \
- 'git fast-import <input &&
- git diff-tree -M -r M4^ M4 >actual &&
- cat actual &&
- compare_diff_raw expect actual'
+test_expect_success 'M: rename root to subdirectory' '
+ git fast-import <input &&
+ git diff-tree -M -r M4^ M4 >actual &&
+ cat actual &&
+ compare_diff_raw expect actual
+'
###
### series N
@@ -1047,11 +1047,11 @@ INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
EOF
-test_expect_success \
- 'N: copy file in same subdirectory' \
- 'git fast-import <input &&
- git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
- compare_diff_raw expect actual'
+test_expect_success 'N: copy file in same subdirectory' '
+ git fast-import <input &&
+ git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
+ compare_diff_raw expect actual
+'
cat >input <<INPUT_END
commit refs/heads/N2
@@ -1081,11 +1081,11 @@ cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
-test_expect_success \
- 'N: copy then modify subdirectory' \
- 'git fast-import <input &&
- git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
- compare_diff_raw expect actual'
+test_expect_success 'N: copy then modify subdirectory' '
+ git fast-import <input &&
+ git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
+ compare_diff_raw expect actual
+'
cat >input <<INPUT_END
commit refs/heads/N3
@@ -1105,19 +1105,18 @@ D file2/file5
INPUT_END
-test_expect_success \
- 'N: copy dirty subdirectory' \
- 'git fast-import <input &&
- test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'
+test_expect_success 'N: copy dirty subdirectory' '
+ git fast-import <input &&
+ test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`
+'
-test_expect_success \
- 'N: copy directory by id' \
- 'cat >expect <<-\EOF &&
+test_expect_success 'N: copy directory by id' '
+ cat >expect <<-\EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
- subdir=$(git rev-parse refs/heads/branch^0:file2) &&
- cat >input <<-INPUT_END &&
+ subdir=$(git rev-parse refs/heads/branch^0:file2) &&
+ cat >input <<-INPUT_END &&
commit refs/heads/N4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1127,9 +1126,10 @@ test_expect_success \
from refs/heads/branch^0
M 040000 $subdir file3
INPUT_END
- git fast-import <input &&
- git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
- compare_diff_raw expect actual'
+ git fast-import <input &&
+ git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
+ compare_diff_raw expect actual
+'
test_expect_success PIPE 'N: read and copy directory' '
cat >expect <<-\EOF &&
@@ -1202,14 +1202,13 @@ test_expect_success PIPE 'N: empty directory reads as missing' '
test_cmp expect actual
'
-test_expect_success \
- 'N: copy root directory by tree hash' \
- 'cat >expect <<-\EOF &&
+test_expect_success 'N: copy root directory by tree hash' '
+ cat >expect <<-\EOF &&
:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf
:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf
EOF
- root=$(git rev-parse refs/heads/branch^0^{tree}) &&
- cat >input <<-INPUT_END &&
+ root=$(git rev-parse refs/heads/branch^0^{tree}) &&
+ cat >input <<-INPUT_END &&
commit refs/heads/N6
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1219,20 +1218,20 @@ test_expect_success \
from refs/heads/branch^0
M 040000 $root ""
INPUT_END
- git fast-import <input &&
- git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
- compare_diff_raw expect actual'
+ git fast-import <input &&
+ git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
+ compare_diff_raw expect actual
+'
-test_expect_success \
- 'N: copy root by path' \
- 'cat >expect <<-\EOF &&
+test_expect_success 'N: copy root by path' '
+ cat >expect <<-\EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf oldroot/file2/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf oldroot/file2/oldf
:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 C100 file4 oldroot/file4
:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 C100 newdir/exec.sh oldroot/newdir/exec.sh
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting oldroot/newdir/interesting
EOF
- cat >input <<-INPUT_END &&
+ cat >input <<-INPUT_END &&
commit refs/heads/N-copy-root-path
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1242,21 +1241,21 @@ test_expect_success \
from refs/heads/branch^0
C "" oldroot
INPUT_END
- git fast-import <input &&
- git diff-tree -C --find-copies-harder -r branch N-copy-root-path >actual &&
- compare_diff_raw expect actual'
+ git fast-import <input &&
+ git diff-tree -C --find-copies-harder -r branch N-copy-root-path >actual &&
+ compare_diff_raw expect actual
+'
-test_expect_success \
- 'N: delete directory by copying' \
- 'cat >expect <<-\EOF &&
+test_expect_success 'N: delete directory by copying' '
+ cat >expect <<-\EOF &&
OBJID
:100644 000000 OBJID OBJID D foo/bar/qux
OBJID
:000000 100644 OBJID OBJID A foo/bar/baz
:000000 100644 OBJID OBJID A foo/bar/qux
EOF
- empty_tree=$(git mktree </dev/null) &&
- cat >input <<-INPUT_END &&
+ empty_tree=$(git mktree </dev/null) &&
+ cat >input <<-INPUT_END &&
commit refs/heads/N-delete
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1282,21 +1281,21 @@ test_expect_success \
M 040000 $empty_tree foo/bar/qux
INPUT_END
- git fast-import <input &&
- git rev-list N-delete |
+ git fast-import <input &&
+ git rev-list N-delete |
git diff-tree -r --stdin --root --always |
sed -e "s/$_x40/OBJID/g" >actual &&
- test_cmp expect actual'
+ test_cmp expect actual
+'
-test_expect_success \
- 'N: modify copied tree' \
- 'cat >expect <<-\EOF &&
+test_expect_success 'N: modify copied tree' '
+ cat >expect <<-\EOF &&
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
- subdir=$(git rev-parse refs/heads/branch^0:file2) &&
- cat >input <<-INPUT_END &&
+ subdir=$(git rev-parse refs/heads/branch^0:file2) &&
+ cat >input <<-INPUT_END &&
commit refs/heads/N5
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1317,14 +1316,14 @@ test_expect_success \
$file5_data
EOF
INPUT_END
- git fast-import <input &&
- git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
- compare_diff_raw expect actual'
-
-test_expect_success \
- 'N: reject foo/ syntax' \
- 'subdir=$(git rev-parse refs/heads/branch^0:file2) &&
- test_must_fail git fast-import <<-INPUT_END
+ git fast-import <input &&
+ git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
+ compare_diff_raw expect actual
+'
+
+test_expect_success 'N: reject foo/ syntax' '
+ subdir=$(git rev-parse refs/heads/branch^0:file2) &&
+ test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5B
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1333,11 +1332,11 @@ test_expect_success \
from refs/heads/branch^0
M 040000 $subdir file3/
- INPUT_END'
+ INPUT_END
+'
-test_expect_success \
- 'N: reject foo/ syntax in copy source' \
- 'test_must_fail git fast-import <<-INPUT_END
+test_expect_success 'N: reject foo/ syntax in copy source' '
+ test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5C
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1346,11 +1345,11 @@ test_expect_success \
from refs/heads/branch^0
C file2/ file3
- INPUT_END'
+ INPUT_END
+'
-test_expect_success \
- 'N: reject foo/ syntax in rename source' \
- 'test_must_fail git fast-import <<-INPUT_END
+test_expect_success 'N: reject foo/ syntax in rename source' '
+ test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5D
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1359,11 +1358,11 @@ test_expect_success \
from refs/heads/branch^0
R file2/ file3
- INPUT_END'
+ INPUT_END
+'
-test_expect_success \
- 'N: reject foo/ syntax in ls argument' \
- 'test_must_fail git fast-import <<-INPUT_END
+test_expect_success 'N: reject foo/ syntax in ls argument' '
+ test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5E
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1372,13 +1371,13 @@ test_expect_success \
from refs/heads/branch^0
ls "file2/"
- INPUT_END'
+ INPUT_END
+'
-test_expect_success \
- 'N: copy to root by id and modify' \
- 'echo "hello, world" >expect.foo &&
- echo hello >expect.bar &&
- git fast-import <<-SETUP_END &&
+test_expect_success 'N: copy to root by id and modify' '
+ echo "hello, world" >expect.foo &&
+ echo hello >expect.bar &&
+ git fast-import <<-SETUP_END &&
commit refs/heads/N7
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1392,8 +1391,8 @@ test_expect_success \
EOF
SETUP_END
- tree=$(git rev-parse --verify N7:) &&
- git fast-import <<-INPUT_END &&
+ tree=$(git rev-parse --verify N7:) &&
+ git fast-import <<-INPUT_END &&
commit refs/heads/N8
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1406,15 +1405,15 @@ test_expect_success \
hello, world
EOF
INPUT_END
- git show N8:foo/foo >actual.foo &&
- git show N8:foo/bar >actual.bar &&
- test_cmp expect.foo actual.foo &&
- test_cmp expect.bar actual.bar'
-
-test_expect_success \
- 'N: extract subtree' \
- 'branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
- cat >input <<-INPUT_END &&
+ git show N8:foo/foo >actual.foo &&
+ git show N8:foo/bar >actual.bar &&
+ test_cmp expect.foo actual.foo &&
+ test_cmp expect.bar actual.bar
+'
+
+test_expect_success 'N: extract subtree' '
+ branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
+ cat >input <<-INPUT_END &&
commit refs/heads/N9
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1424,14 +1423,14 @@ test_expect_success \
M 040000 $branch ""
C "newdir" ""
INPUT_END
- git fast-import <input &&
- git diff --exit-code branch:newdir N9'
-
-test_expect_success \
- 'N: modify subtree, extract it, and modify again' \
- 'echo hello >expect.baz &&
- echo hello, world >expect.qux &&
- git fast-import <<-SETUP_END &&
+ git fast-import <input &&
+ git diff --exit-code branch:newdir N9
+'
+
+test_expect_success 'N: modify subtree, extract it, and modify again' '
+ echo hello >expect.baz &&
+ echo hello, world >expect.qux &&
+ git fast-import <<-SETUP_END &&
commit refs/heads/N10
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1445,8 +1444,8 @@ test_expect_success \
EOF
SETUP_END
- tree=$(git rev-parse --verify N10:) &&
- git fast-import <<-INPUT_END &&
+ tree=$(git rev-parse --verify N10:) &&
+ git fast-import <<-INPUT_END &&
commit refs/heads/N11
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1461,12 +1460,12 @@ test_expect_success \
R "foo" ""
C "bar/qux" "bar/quux"
INPUT_END
- git show N11:bar/baz >actual.baz &&
- git show N11:bar/qux >actual.qux &&
- git show N11:bar/quux >actual.quux &&
- test_cmp expect.baz actual.baz &&
- test_cmp expect.qux actual.qux &&
- test_cmp expect.qux actual.quux'
+ git show N11:bar/baz >actual.baz &&
+ git show N11:bar/qux >actual.qux &&
+ git show N11:bar/quux >actual.quux &&
+ test_cmp expect.baz actual.baz &&
+ test_cmp expect.qux actual.qux &&
+ test_cmp expect.qux actual.quux'
###
### series O
@@ -1503,10 +1502,10 @@ D file2/file5
INPUT_END
-test_expect_success \
- 'O: comments are all skipped' \
- 'git fast-import <input &&
- test `git rev-parse N3` = `git rev-parse O1`'
+test_expect_success 'O: comments are all skipped' '
+ git fast-import <input &&
+ test `git rev-parse N3` = `git rev-parse O1`
+'
cat >input <<INPUT_END
commit refs/heads/O2
@@ -1524,14 +1523,14 @@ D file2/file5
INPUT_END
-test_expect_success \
- 'O: blank lines not necessary after data commands' \
- 'git fast-import <input &&
- test `git rev-parse N3` = `git rev-parse O2`'
+test_expect_success 'O: blank lines not necessary after data commands' '
+ git fast-import <input &&
+ test `git rev-parse N3` = `git rev-parse O2`
+'
-test_expect_success \
- 'O: repack before next test' \
- 'git repack -a -d'
+test_expect_success 'O: repack before next test' '
+ git repack -a -d
+'
cat >input <<INPUT_END
commit refs/heads/O3
@@ -1569,13 +1568,13 @@ of
empty
commits
INPUT_END
-test_expect_success \
- 'O: blank lines not necessary after other commands' \
- 'git fast-import <input &&
- test 8 = `find .git/objects/pack -type f | wc -l` &&
- test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
- git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
- test_cmp expect actual'
+test_expect_success 'O: blank lines not necessary after other commands' '
+ git fast-import <input &&
+ test 8 = `find .git/objects/pack -type f | wc -l` &&
+ test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
+ git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
+ test_cmp expect actual
+'
cat >input <<INPUT_END
commit refs/heads/O4
@@ -1602,11 +1601,11 @@ zcommits
COMMIT
progress I'm done!
INPUT_END
-test_expect_success \
- 'O: progress outputs as requested by input' \
- 'git fast-import <input >actual &&
- grep "progress " <input >expect &&
- test_cmp expect actual'
+test_expect_success 'O: progress outputs as requested by input' '
+ git fast-import <input >actual &&
+ grep "progress " <input >expect &&
+ test_cmp expect actual
+'
###
### series P (gitlinks)
@@ -1667,16 +1666,16 @@ M 160000 :6 sub
INPUT_END
-test_expect_success \
- 'P: superproject & submodule mix' \
- 'git fast-import <input &&
- git checkout subuse1 &&
- rm -rf sub && mkdir sub && (cd sub &&
- git init &&
- git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
- git checkout master) &&
- git submodule init &&
- git submodule update'
+test_expect_success 'P: superproject & submodule mix' '
+ git fast-import <input &&
+ git checkout subuse1 &&
+ rm -rf sub && mkdir sub && (cd sub &&
+ git init &&
+ git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
+ git checkout master) &&
+ git submodule init &&
+ git submodule update
+'
SUBLAST=$(git rev-parse --verify sub)
SUBPREV=$(git rev-parse --verify sub^)
@@ -1709,12 +1708,12 @@ M 160000 $SUBLAST sub
INPUT_END
-test_expect_success \
- 'P: verbatim SHA gitlinks' \
- 'git branch -D sub &&
- git gc && git prune &&
- git fast-import <input &&
- test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)'
+test_expect_success 'P: verbatim SHA gitlinks' '
+ git branch -D sub &&
+ git gc && git prune &&
+ git fast-import <input &&
+ test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
+'
test_tick
cat >input <<INPUT_END
@@ -1734,7 +1733,8 @@ DATA
INPUT_END
test_expect_success 'P: fail on inline gitlink' '
- test_must_fail git fast-import <input'
+ test_must_fail git fast-import <input
+'
test_tick
cat >input <<INPUT_END
@@ -1757,7 +1757,8 @@ M 160000 :1 sub
INPUT_END
test_expect_success 'P: fail on blob mark in gitlink' '
- test_must_fail git fast-import <input'
+ test_must_fail git fast-import <input
+'
###
### series Q (notes)
@@ -1882,10 +1883,10 @@ EOF
INPUT_END
-test_expect_success \
- 'Q: commit notes' \
- 'git fast-import <input &&
- git whatchanged notes-test'
+test_expect_success 'Q: commit notes' '
+ git fast-import <input &&
+ git whatchanged notes-test
+'
test_expect_success 'Q: verify pack' '
verify_packs
@@ -1901,10 +1902,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
first (:3)
EOF
-test_expect_success \
- 'Q: verify first commit' \
- 'git cat-file commit notes-test~2 | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify first commit' '
+ git cat-file commit notes-test~2 | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect <<EOF
parent $commit1
@@ -1913,10 +1914,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
second (:5)
EOF
-test_expect_success \
- 'Q: verify second commit' \
- 'git cat-file commit notes-test^ | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify second commit' '
+ git cat-file commit notes-test^ | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect <<EOF
parent $commit2
@@ -1925,10 +1926,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
third (:6)
EOF
-test_expect_success \
- 'Q: verify third commit' \
- 'git cat-file commit notes-test | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify third commit' '
+ git cat-file commit notes-test | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect <<EOF
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -1936,10 +1937,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:9)
EOF
-test_expect_success \
- 'Q: verify first notes commit' \
- 'git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify first notes commit' '
+ git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect.unsorted <<EOF
100644 blob $commit1
@@ -1947,25 +1948,25 @@ cat >expect.unsorted <<EOF
100644 blob $commit3
EOF
cat expect.unsorted | sort >expect
-test_expect_success \
- 'Q: verify first notes tree' \
- 'git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify first notes tree' '
+ git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
+ test_cmp expect actual
+'
echo "$note1_data" >expect
-test_expect_success \
- 'Q: verify first note for first commit' \
- 'git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify first note for first commit' '
+ git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual
+'
echo "$note2_data" >expect
-test_expect_success \
- 'Q: verify first note for second commit' \
- 'git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify first note for second commit' '
+ git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual
+'
echo "$note3_data" >expect
-test_expect_success \
- 'Q: verify first note for third commit' \
- 'git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify first note for third commit' '
+ git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual
+'
cat >expect <<EOF
parent `git rev-parse --verify refs/notes/foobar~2`
@@ -1974,10 +1975,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:10)
EOF
-test_expect_success \
- 'Q: verify second notes commit' \
- 'git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify second notes commit' '
+ git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect.unsorted <<EOF
100644 blob $commit1
@@ -1985,25 +1986,25 @@ cat >expect.unsorted <<EOF
100644 blob $commit3
EOF
cat expect.unsorted | sort >expect
-test_expect_success \
- 'Q: verify second notes tree' \
- 'git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify second notes tree' '
+ git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
+ test_cmp expect actual
+'
echo "$note1b_data" >expect
-test_expect_success \
- 'Q: verify second note for first commit' \
- 'git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify second note for first commit' '
+ git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual
+'
echo "$note2_data" >expect
-test_expect_success \
- 'Q: verify first note for second commit' \
- 'git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify first note for second commit' '
+ git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual
+'
echo "$note3_data" >expect
-test_expect_success \
- 'Q: verify first note for third commit' \
- 'git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify first note for third commit' '
+ git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual
+'
cat >expect <<EOF
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -2011,24 +2012,24 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:11)
EOF
-test_expect_success \
- 'Q: verify third notes commit' \
- 'git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify third notes commit' '
+ git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect.unsorted <<EOF
100644 blob $commit1
EOF
cat expect.unsorted | sort >expect
-test_expect_success \
- 'Q: verify third notes tree' \
- 'git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify third notes tree' '
+ git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
+ test_cmp expect actual
+'
echo "$note1c_data" >expect
-test_expect_success \
- 'Q: verify third note for first commit' \
- 'git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify third note for first commit' '
+ git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual
+'
cat >expect <<EOF
parent `git rev-parse --verify refs/notes/foobar^`
@@ -2037,24 +2038,24 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:12)
EOF
-test_expect_success \
- 'Q: verify fourth notes commit' \
- 'git cat-file commit refs/notes/foobar | sed 1d >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify fourth notes commit' '
+ git cat-file commit refs/notes/foobar | sed 1d >actual &&
+ test_cmp expect actual
+'
cat >expect.unsorted <<EOF
100644 blob $commit2
EOF
cat expect.unsorted | sort >expect
-test_expect_success \
- 'Q: verify fourth notes tree' \
- 'git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
- test_cmp expect actual'
+test_expect_success 'Q: verify fourth notes tree' '
+ git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
+ test_cmp expect actual
+'
echo "$note2b_data" >expect
-test_expect_success \
- 'Q: verify second note for second commit' \
- 'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual'
+test_expect_success 'Q: verify second note for second commit' '
+ git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual
+'
cat >input <<EOF
reset refs/heads/Q0
@@ -2070,9 +2071,9 @@ data <<NOTE
some note
NOTE
EOF
-test_expect_success \
- 'Q: deny note on empty branch' \
- 'test_must_fail git fast-import <input'
+test_expect_success 'Q: deny note on empty branch' '
+ test_must_fail git fast-import <input
+'
###
### series R (feature and option)
###
@@ -2122,15 +2123,15 @@ hi
EOF
-test_expect_success \
- 'R: export-marks feature results in a marks file being created' \
- 'cat input | git fast-import &&
- grep :1 git.marks'
+test_expect_success 'R: export-marks feature results in a marks file being created' '
+ cat input | git fast-import &&
+ grep :1 git.marks
+'
-test_expect_success \
- 'R: export-marks options can be overridden by commandline options' \
- 'cat input | git fast-import --export-marks=other.marks &&
- grep :1 other.marks'
+test_expect_success 'R: export-marks options can be overridden by commandline options' '
+ cat input | git fast-import --export-marks=other.marks &&
+ grep :1 other.marks
+'
test_expect_success 'R: catch typo in marks file name' '
test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
@@ -2239,20 +2240,20 @@ feature import-marks=marks.out
feature export-marks=marks.new
EOF
-test_expect_success \
- 'R: import to output marks works without any content' \
- 'cat input | git fast-import &&
- test_cmp marks.out marks.new'
+test_expect_success 'R: import to output marks works without any content' '
+ cat input | git fast-import &&
+ test_cmp marks.out marks.new
+'
cat >input <<EOF
feature import-marks=nonexistent.marks
feature export-marks=marks.new
EOF
-test_expect_success \
- 'R: import marks prefers commandline marks file over the stream' \
- 'cat input | git fast-import --import-marks=marks.out &&
- test_cmp marks.out marks.new'
+test_expect_success 'R: import marks prefers commandline marks file over the stream' '
+ cat input | git fast-import --import-marks=marks.out &&
+ test_cmp marks.out marks.new
+'
cat >input <<EOF
@@ -2261,10 +2262,10 @@ feature export-marks=combined.marks
EOF
test_expect_success 'R: multiple --import-marks= should be honoured' '
- head -n2 marks.out > one.marks &&
- tail -n +3 marks.out > two.marks &&
- git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
- test_cmp marks.out combined.marks
+ head -n2 marks.out > one.marks &&
+ tail -n +3 marks.out > two.marks &&
+ git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
+ test_cmp marks.out combined.marks
'
cat >input <<EOF
@@ -2274,10 +2275,10 @@ feature export-marks=relative.out
EOF
test_expect_success 'R: feature relative-marks should be honoured' '
- mkdir -p .git/info/fast-import/ &&
- cp marks.new .git/info/fast-import/relative.in &&
- git fast-import <input &&
- test_cmp marks.new .git/info/fast-import/relative.out
+ mkdir -p .git/info/fast-import/ &&
+ cp marks.new .git/info/fast-import/relative.in &&
+ git fast-import <input &&
+ test_cmp marks.new .git/info/fast-import/relative.out
'
cat >input <<EOF
@@ -2288,8 +2289,8 @@ feature export-marks=non-relative.out
EOF
test_expect_success 'R: feature no-relative-marks should be honoured' '
- git fast-import <input &&
- test_cmp marks.new non-relative.out
+ git fast-import <input &&
+ test_cmp marks.new non-relative.out
'
test_expect_success 'R: feature ls supported' '
@@ -2558,8 +2559,8 @@ hi
EOF
test_expect_success 'R: quiet option results in no stats being output' '
- cat input | git fast-import 2> output &&
- test_cmp empty output
+ cat input | git fast-import 2> output &&
+ test_cmp empty output
'
test_expect_success 'R: feature done means terminating "done" is mandatory' '
@@ -2609,11 +2610,11 @@ option git non-existing-option
EOF
test_expect_success 'R: die on unknown option' '
- test_must_fail git fast-import <input
+ test_must_fail git fast-import <input
'
test_expect_success 'R: unknown commandline options are rejected' '\
- test_must_fail git fast-import --non-existing-option < /dev/null
+ test_must_fail git fast-import --non-existing-option < /dev/null
'
test_expect_success 'R: die on invalid option argument' '
@@ -2629,7 +2630,7 @@ option non-existing-vcs non-existing-option
EOF
test_expect_success 'R: ignore non-git options' '
- git fast-import <input
+ git fast-import <input
'
##
@@ -2655,10 +2656,10 @@ INPUT_END
cat expect >>input
echo >>input
-test_expect_success \
- 'R: blob bigger than threshold' \
- 'test_create_repo R &&
- git --git-dir=R/.git fast-import --big-file-threshold=1 <input'
+test_expect_success 'R: blob bigger than threshold' '
+ test_create_repo R &&
+ git --git-dir=R/.git fast-import --big-file-threshold=1 <input
+'
test_expect_success 'R: verify created pack' '
(
@@ -2667,17 +2668,18 @@ test_expect_success 'R: verify created pack' '
)
'
-test_expect_success \
- 'R: verify written objects' \
- 'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
- test_cmp_bin expect actual &&
- a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
- b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
- test $a = $b'
-test_expect_success \
- 'R: blob appears only once' \
- 'n=$(grep $a verify | wc -l) &&
- test 1 = $n'
+test_expect_success 'R: verify written objects' '
+ git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
+ test_cmp_bin expect actual &&
+ a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
+ b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
+ test $a = $b
+'
+
+test_expect_success 'R: blob appears only once' '
+ n=$(grep $a verify | wc -l) &&
+ test 1 = $n
+'
###
### series S
@@ -3088,7 +3090,7 @@ D ""
INPUT_END
test_expect_success 'U: filedelete root succeeds' '
- git fast-import <input
+ git fast-import <input
'
cat >expect <<EOF
--
2.6.2.337.ga235d84
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/7] modernize t9300: use test_must_fail
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
2015-11-19 19:09 ` [PATCH 1/7] modernize t9300: single-quote placement and indentation Johannes Sixt
@ 2015-11-19 19:09 ` Johannes Sixt
2015-11-19 19:09 ` [PATCH 3/7] modernize t9300: use test_must_be_empty Johannes Sixt
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
One test case open-codes a test for an expected failure. Replace it by
test_must_fail.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9300-fast-import.sh | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 566f7bd..e9c7602 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -630,20 +630,9 @@ from refs/heads/branch
INPUT_END
test_expect_success 'F: non-fast-forward update skips' '
- if git fast-import <input
- then
- echo BAD gfi did not fail
- return 1
- else
- if test $old_branch = `git rev-parse --verify branch^0`
- then
- : branch unaffected and failure returned
- return 0
- else
- echo BAD gfi changed branch $old_branch
- return 1
- fi
- fi
+ test_must_fail git fast-import <input &&
+ # branch must remain unaffected
+ test $old_branch = `git rev-parse --verify branch^0`
'
test_expect_success 'F: verify pack' '
--
2.6.2.337.ga235d84
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/7] modernize t9300: use test_must_be_empty
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
2015-11-19 19:09 ` [PATCH 1/7] modernize t9300: single-quote placement and indentation Johannes Sixt
2015-11-19 19:09 ` [PATCH 2/7] modernize t9300: use test_must_fail Johannes Sixt
@ 2015-11-19 19:09 ` Johannes Sixt
2015-11-19 19:09 ` [PATCH 4/7] modernize t9300: wrap lines after && Johannes Sixt
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
Instead of comparing actual output to an empty file, use
test_must_be_empty. In addition to the better error message provided by
the helper, allocation of an empty file during the setup sequence can be
avoided.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9300-fast-import.sh | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index e9c7602..ceb3db3 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -47,8 +47,6 @@ file5_data='an inline file.
file6_data='#!/bin/sh
echo "$@"'
->empty
-
###
### series A
###
@@ -2320,12 +2318,12 @@ test_expect_success !MINGW 'R: in-stream cat-blob-fd not respected' '
cat-blob $blob
EOF
test_cmp expect actual.3 &&
- test_cmp empty actual.1 &&
+ test_must_be_empty actual.1 &&
git fast-import 3>actual.3 >actual.1 <<-EOF &&
option cat-blob-fd=3
cat-blob $blob
EOF
- test_cmp empty actual.3 &&
+ test_must_be_empty actual.3 &&
test_cmp expect actual.1
'
@@ -2549,7 +2547,7 @@ EOF
test_expect_success 'R: quiet option results in no stats being output' '
cat input | git fast-import 2> output &&
- test_cmp empty output
+ test_must_be_empty output
'
test_expect_success 'R: feature done means terminating "done" is mandatory' '
--
2.6.2.337.ga235d84
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/7] modernize t9300: wrap lines after &&
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
` (2 preceding siblings ...)
2015-11-19 19:09 ` [PATCH 3/7] modernize t9300: use test_must_be_empty Johannes Sixt
@ 2015-11-19 19:09 ` Johannes Sixt
2015-11-19 19:09 ` [PATCH 5/7] modernize t9300: use test_when_finished for clean-up Johannes Sixt
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
It is customary to have each command in test snippets on its own line.
Fix those instances that do not follow this guideline.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9300-fast-import.sh | 48 ++++++++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index ceb3db3..c36afdb 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -130,17 +130,20 @@ test_expect_success 'A: verify tree' '
echo "$file2_data" >expect
test_expect_success 'A: verify file2' '
- git cat-file blob master:file2 >actual && test_cmp expect actual
+ git cat-file blob master:file2 >actual &&
+ test_cmp expect actual
'
echo "$file3_data" >expect
test_expect_success 'A: verify file3' '
- git cat-file blob master:file3 >actual && test_cmp expect actual
+ git cat-file blob master:file3 >actual &&
+ test_cmp expect actual
'
printf "$file4_data" >expect
test_expect_success 'A: verify file4' '
- git cat-file blob master:file4 >actual && test_cmp expect actual
+ git cat-file blob master:file4 >actual &&
+ test_cmp expect actual
'
cat >expect <<EOF
@@ -1656,10 +1659,14 @@ INPUT_END
test_expect_success 'P: superproject & submodule mix' '
git fast-import <input &&
git checkout subuse1 &&
- rm -rf sub && mkdir sub && (cd sub &&
- git init &&
- git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
- git checkout master) &&
+ rm -rf sub &&
+ mkdir sub &&
+ (
+ cd sub &&
+ git init &&
+ git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
+ git checkout master
+ ) &&
git submodule init &&
git submodule update
'
@@ -1697,7 +1704,8 @@ INPUT_END
test_expect_success 'P: verbatim SHA gitlinks' '
git branch -D sub &&
- git gc && git prune &&
+ git gc &&
+ git prune &&
git fast-import <input &&
test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
'
@@ -1942,17 +1950,20 @@ test_expect_success 'Q: verify first notes tree' '
echo "$note1_data" >expect
test_expect_success 'Q: verify first note for first commit' '
- git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar~2:$commit1 >actual &&
+ test_cmp expect actual
'
echo "$note2_data" >expect
test_expect_success 'Q: verify first note for second commit' '
- git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar~2:$commit2 >actual &&
+ test_cmp expect actual
'
echo "$note3_data" >expect
test_expect_success 'Q: verify first note for third commit' '
- git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar~2:$commit3 >actual &&
+ test_cmp expect actual
'
cat >expect <<EOF
@@ -1980,17 +1991,20 @@ test_expect_success 'Q: verify second notes tree' '
echo "$note1b_data" >expect
test_expect_success 'Q: verify second note for first commit' '
- git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar^:$commit1 >actual &&
+ test_cmp expect actual
'
echo "$note2_data" >expect
test_expect_success 'Q: verify first note for second commit' '
- git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar^:$commit2 >actual &&
+ test_cmp expect actual
'
echo "$note3_data" >expect
test_expect_success 'Q: verify first note for third commit' '
- git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar^:$commit3 >actual &&
+ test_cmp expect actual
'
cat >expect <<EOF
@@ -2015,7 +2029,8 @@ test_expect_success 'Q: verify third notes tree' '
echo "$note1c_data" >expect
test_expect_success 'Q: verify third note for first commit' '
- git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar2:$commit1 >actual &&
+ test_cmp expect actual
'
cat >expect <<EOF
@@ -2041,7 +2056,8 @@ test_expect_success 'Q: verify fourth notes tree' '
echo "$note2b_data" >expect
test_expect_success 'Q: verify second note for second commit' '
- git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual
+ git cat-file blob refs/notes/foobar:$commit2 >actual &&
+ test_cmp expect actual
'
cat >input <<EOF
--
2.6.2.337.ga235d84
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/7] modernize t9300: use test_when_finished for clean-up
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
` (3 preceding siblings ...)
2015-11-19 19:09 ` [PATCH 4/7] modernize t9300: wrap lines after && Johannes Sixt
@ 2015-11-19 19:09 ` Johannes Sixt
2015-11-19 19:09 ` [PATCH 6/7] modernize t9300: mark here-doc words to ignore tab indentation Johannes Sixt
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
A number of clean-ups of test cases are performed outside of
test_expect_success. Replace these cases by using test_when_finished.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9300-fast-import.sh | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index c36afdb..adabd68 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -344,9 +344,9 @@ M 755 0000000000000000000000000000000000000001 zero1
INPUT_END
test_expect_success 'B: fail on invalid blob sha1' '
+ test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
test_must_fail git fast-import <input
'
-rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
commit TEMP_TAG
@@ -359,14 +359,13 @@ from refs/heads/master
INPUT_END
test_expect_success 'B: accept branch name "TEMP_TAG"' '
+ test_when_finished "rm -f .git/TEMP_TAG
+ git gc
+ git prune" &&
git fast-import <input &&
test -f .git/TEMP_TAG &&
test `git rev-parse master` = `git rev-parse TEMP_TAG^`
'
-rm -f .git/TEMP_TAG
-
-git gc 2>/dev/null >/dev/null
-git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/empty-committer-1
@@ -376,15 +375,14 @@ empty commit
COMMIT
INPUT_END
test_expect_success 'B: accept empty committer' '
+ test_when_finished "git update-ref -d refs/heads/empty-committer-1
+ git gc
+ git prune" &&
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
-git update-ref -d refs/heads/empty-committer-1 || true
-
-git gc 2>/dev/null >/dev/null
-git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/empty-committer-2
@@ -394,15 +392,14 @@ empty commit
COMMIT
INPUT_END
test_expect_success 'B: accept and fixup committer with no name' '
+ test_when_finished "git update-ref -d refs/heads/empty-committer-2
+ git gc
+ git prune" &&
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
-git update-ref -d refs/heads/empty-committer-2 || true
-
-git gc 2>/dev/null >/dev/null
-git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@ -412,9 +409,9 @@ empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (1)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@ -424,9 +421,9 @@ empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (2)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@ -436,9 +433,9 @@ empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (3)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@ -448,9 +445,9 @@ empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (4)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
@@ -460,9 +457,9 @@ empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (5)' '
+ test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-git update-ref -d refs/heads/invalid-committer || true
###
### series C
@@ -914,6 +911,7 @@ g/b/h
EOF
test_expect_success 'L: nested tree copy does not corrupt deltas' '
+ test_when_finished "git update-ref -d refs/heads/L2" &&
git fast-import <input &&
git ls-tree L2 g/b/ >tmp &&
cat tmp | cut -f 2 >actual &&
@@ -921,8 +919,6 @@ test_expect_success 'L: nested tree copy does not corrupt deltas' '
git fsck `git rev-parse L2`
'
-git update-ref -d refs/heads/L2
-
###
### series M
###
--
2.6.2.337.ga235d84
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/7] modernize t9300: mark here-doc words to ignore tab indentation
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
` (4 preceding siblings ...)
2015-11-19 19:09 ` [PATCH 5/7] modernize t9300: use test_when_finished for clean-up Johannes Sixt
@ 2015-11-19 19:09 ` Johannes Sixt
2015-11-19 19:09 ` [PATCH 7/7] modernize t9300: move test preparations into test_expect_success Johannes Sixt
2015-11-20 3:54 ` [PATCH 0/7] Modernize t9300-fast-import Eric Sunshine
7 siblings, 0 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
In the next commit, we will indent test case preparations. This will
require that here-documents ignore the tab indentation. Prepare for
this change by marking the here-doc words accordingly. This does not
have an effect now, but will remove some noise from the git diff -b
output of the next commit.
The change here is entirely automated with this perl command:
perl -i -lpe 's/(cat.*<<) *((EOF|(EXPECT|INPUT)_END).*$)/$1-$2 &&/' t/t9300-fast-import.sh
i.e., inserts a dash between << and the EOF word (and removes blanks
that our style guide abhors) and appends the && that will become
necessary.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9300-fast-import.sh | 200 ++++++++++++++++++++++++-------------------------
1 file changed, 100 insertions(+), 100 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index adabd68..7586f41 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -57,7 +57,7 @@ test_expect_success 'empty stream succeeds' '
git fast-import </dev/null
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
blob
mark :2
data <<EOF
@@ -107,7 +107,7 @@ test_expect_success 'A: verify pack' '
verify_packs
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -118,7 +118,7 @@ test_expect_success 'A: verify commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
100644 blob file2
100644 blob file3
100755 blob file4
@@ -146,7 +146,7 @@ test_expect_success 'A: verify file4' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
object $(git rev-parse refs/heads/master)
type commit
tag series-A
@@ -158,7 +158,7 @@ test_expect_success 'A: verify tag/series-A' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
object $(git rev-parse refs/heads/master:file3)
type blob
tag series-A-blob
@@ -170,7 +170,7 @@ test_expect_success 'A: verify tag/series-A-blob' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:2 `git rev-parse --verify master:file2`
:3 `git rev-parse --verify master:file3`
:4 `git rev-parse --verify master:file4`
@@ -190,7 +190,7 @@ test_expect_success 'A: verify marks import' '
test_tick
new_blob=$(echo testing | git hash-object --stdin)
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
tag series-A-blob-2
from $(git rev-parse refs/heads/master:file3)
data <<EOF
@@ -217,7 +217,7 @@ Tag new_blob.
EOF
INPUT_END
-cat >expect <<EOF
+cat >expect <<-EOF &&
object $(git rev-parse refs/heads/master:file3)
type blob
tag series-A-blob-2
@@ -238,7 +238,7 @@ test_expect_success 'A: tag blob by sha1' '
'
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/verify--import-marks
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -258,7 +258,7 @@ test_expect_success 'A: verify pack' '
verify_packs
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
EOF
git diff-tree -M -r master verify--import-marks >actual
@@ -274,7 +274,7 @@ mt=$(git hash-object --stdin < /dev/null)
: >marks.exp
: >tree.exp
-cat >input.commit <<EOF
+cat >input.commit <<-EOF &&
commit refs/heads/verify--dump-marks
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -287,7 +287,7 @@ l=4
m=6
n=7
while test "$i" -lt 27; do
- cat >>input.blob <<EOF
+ cat >>input.blob <<-EOF &&
blob
mark :$l
data 0
@@ -331,7 +331,7 @@ test_expect_success 'A: export marks with large values' '
###
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/branch
mark :1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -348,7 +348,7 @@ test_expect_success 'B: fail on invalid blob sha1' '
test_must_fail git fast-import <input
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit TEMP_TAG
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -367,7 +367,7 @@ test_expect_success 'B: accept branch name "TEMP_TAG"' '
test `git rev-parse master` = `git rev-parse TEMP_TAG^`
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/empty-committer-1
committer <> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -384,7 +384,7 @@ test_expect_success 'B: accept empty committer' '
test -z "$out"
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/empty-committer-2
committer <a@b.com> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -401,7 +401,7 @@ test_expect_success 'B: accept and fixup committer with no name' '
test -z "$out"
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/invalid-committer
committer Name email> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -413,7 +413,7 @@ test_expect_success 'B: fail on invalid committer (1)' '
test_must_fail git fast-import <input
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/invalid-committer
committer Name <e<mail> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -425,7 +425,7 @@ test_expect_success 'B: fail on invalid committer (2)' '
test_must_fail git fast-import <input
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/invalid-committer
committer Name <email>> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -437,7 +437,7 @@ test_expect_success 'B: fail on invalid committer (3)' '
test_must_fail git fast-import <input
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/invalid-committer
committer Name <email $GIT_COMMITTER_DATE
data <<COMMIT
@@ -449,7 +449,7 @@ test_expect_success 'B: fail on invalid committer (4)' '
test_must_fail git fast-import <input
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/invalid-committer
committer Name<email> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -468,7 +468,7 @@ test_expect_success 'B: fail on invalid committer (5)' '
newf=`echo hi newf | git hash-object -w --stdin`
oldf=`git rev-parse --verify master:file2`
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -495,7 +495,7 @@ test_expect_success 'C: validate reuse existing blob' '
test $oldf = `git rev-parse --verify branch:file2/oldf`
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
parent `git rev-parse --verify master^0`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -507,7 +507,7 @@ test_expect_success 'C: verify commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
@@ -522,7 +522,7 @@ test_expect_success 'C: validate rename result' '
###
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -550,7 +550,7 @@ test_expect_success 'D: verify pack' '
verify_packs
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
:000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
EOF
@@ -575,7 +575,7 @@ test_expect_success 'D: verify file6' '
### series E
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/branch
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
@@ -597,7 +597,7 @@ test_expect_success 'E: verify pack' '
verify_packs
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
@@ -614,7 +614,7 @@ test_expect_success 'E: verify commit' '
old_branch=`git rev-parse --verify branch^0`
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -637,7 +637,7 @@ test_expect_success 'F: verify pack' '
verify_packs
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
tree `git rev-parse branch~1^{tree}`
parent `git rev-parse branch~1`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -656,7 +656,7 @@ test_expect_success 'F: verify other commit' '
old_branch=`git rev-parse --verify branch^0`
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -684,7 +684,7 @@ test_expect_success 'G: branch changed, but logged' '
###
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/H
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -713,7 +713,7 @@ test_expect_success 'H: verify pack' '
verify_packs
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
@@ -735,7 +735,7 @@ test_expect_success 'H: verify file' '
### series I
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/export-boundary
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -749,7 +749,7 @@ test_expect_success 'I: export-pack-edges' '
git fast-import --export-pack-edges=edges.list <input
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
.git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
EOF
test_expect_success 'I: verify edge list' '
@@ -761,7 +761,7 @@ test_expect_success 'I: verify edge list' '
### series J
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/J
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -787,7 +787,7 @@ test_expect_success 'J: branch has 1 commit, empty tree' '
test 0 = `git ls-tree J | wc -l`
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
reset refs/heads/J2
tag wrong_tag
@@ -803,7 +803,7 @@ test_expect_success 'J: tag must fail on empty branch' '
### series K
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/K
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -833,7 +833,7 @@ test_expect_success 'K: verify K^1 = branch^1' '
### series L
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
blob
mark :1
data <<EOF
@@ -867,7 +867,7 @@ M 644 :2 b/other
M 644 :2 ba
INPUT_END
-cat >expect <<EXPECT_END
+cat >expect <<-EXPECT_END &&
:100644 100644 4268632... 55d3a52... M b.
:040000 040000 0ae5cac... 443c768... M b
:100644 100644 4268632... 55d3a52... M ba
@@ -879,7 +879,7 @@ test_expect_success 'L: verify internal tree sorting' '
test_cmp expect output
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
blob
mark :1
data <<EOF
@@ -905,7 +905,7 @@ C a/e g/b
M 644 :1 g/b/h
INPUT_END
-cat <<EOF >expect
+cat <<-EOF >expect &&
g/b/f
g/b/h
EOF
@@ -924,7 +924,7 @@ test_expect_success 'L: nested tree copy does not corrupt deltas' '
###
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/M1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -936,7 +936,7 @@ R file2/newf file2/n.e.w.f
INPUT_END
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
EOF
test_expect_success 'M: rename file in same subdirectory' '
@@ -945,7 +945,7 @@ test_expect_success 'M: rename file in same subdirectory' '
compare_diff_raw expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/M2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -957,7 +957,7 @@ R file2/newf i/am/new/to/you
INPUT_END
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
EOF
test_expect_success 'M: rename file to new subdirectory' '
@@ -966,7 +966,7 @@ test_expect_success 'M: rename file to new subdirectory' '
compare_diff_raw expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/M3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -978,7 +978,7 @@ R i other/sub
INPUT_END
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
EOF
test_expect_success 'M: rename subdirectory to new subdirectory' '
@@ -987,7 +987,7 @@ test_expect_success 'M: rename subdirectory to new subdirectory' '
compare_diff_raw expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/M4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -999,7 +999,7 @@ R "" sub
INPUT_END
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
@@ -1018,7 +1018,7 @@ test_expect_success 'M: rename root to subdirectory' '
###
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/N1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1030,7 +1030,7 @@ C file2/newf file2/n.e.w.f
INPUT_END
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
EOF
test_expect_success 'N: copy file in same subdirectory' '
@@ -1039,7 +1039,7 @@ test_expect_success 'N: copy file in same subdirectory' '
compare_diff_raw expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/N2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1062,7 +1062,7 @@ EOF
INPUT_END
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
@@ -1073,7 +1073,7 @@ test_expect_success 'N: copy then modify subdirectory' '
compare_diff_raw expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/N3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1457,7 +1457,7 @@ test_expect_success 'N: modify subtree, extract it, and modify again' '
### series O
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
#we will
commit refs/heads/O1
# -- ignore all of this text
@@ -1493,7 +1493,7 @@ test_expect_success 'O: comments are all skipped' '
test `git rev-parse N3` = `git rev-parse O1`
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/O2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1518,7 +1518,7 @@ test_expect_success 'O: repack before next test' '
git repack -a -d
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/O3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1548,7 +1548,7 @@ reset refs/tags/O3-3rd
from :5
INPUT_END
-cat >expect <<INPUT_END
+cat >expect <<-INPUT_END &&
string
of
empty
@@ -1562,7 +1562,7 @@ test_expect_success 'O: blank lines not necessary after other commands' '
test_cmp expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/O4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -1597,7 +1597,7 @@ test_expect_success 'O: progress outputs as requested by input' '
### series P (gitlinks)
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
blob
mark :1
data 10
@@ -1670,7 +1670,7 @@ test_expect_success 'P: superproject & submodule mix' '
SUBLAST=$(git rev-parse --verify sub)
SUBPREV=$(git rev-parse --verify sub^)
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
blob
mark :1
data <<DATAEND
@@ -1707,7 +1707,7 @@ test_expect_success 'P: verbatim SHA gitlinks' '
'
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/subuse3
mark :1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -1728,7 +1728,7 @@ test_expect_success 'P: fail on inline gitlink' '
'
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
blob
mark :1
data <<DATA
@@ -1763,7 +1763,7 @@ note1c_data="The third note for the first commit"
note2b_data="The second note for the second commit"
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
blob
mark :2
data <<EOF
@@ -1887,7 +1887,7 @@ commit1=$(git rev-parse notes-test~2)
commit2=$(git rev-parse notes-test^)
commit3=$(git rev-parse notes-test)
-cat >expect <<EOF
+cat >expect <<-EOF &&
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -1898,7 +1898,7 @@ test_expect_success 'Q: verify first commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
parent $commit1
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -1910,7 +1910,7 @@ test_expect_success 'Q: verify second commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
parent $commit2
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -1922,7 +1922,7 @@ test_expect_success 'Q: verify third commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -1933,7 +1933,7 @@ test_expect_success 'Q: verify first notes commit' '
test_cmp expect actual
'
-cat >expect.unsorted <<EOF
+cat >expect.unsorted <<-EOF &&
100644 blob $commit1
100644 blob $commit2
100644 blob $commit3
@@ -1962,7 +1962,7 @@ test_expect_success 'Q: verify first note for third commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
parent `git rev-parse --verify refs/notes/foobar~2`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -1974,7 +1974,7 @@ test_expect_success 'Q: verify second notes commit' '
test_cmp expect actual
'
-cat >expect.unsorted <<EOF
+cat >expect.unsorted <<-EOF &&
100644 blob $commit1
100644 blob $commit2
100644 blob $commit3
@@ -2003,7 +2003,7 @@ test_expect_success 'Q: verify first note for third commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -2014,7 +2014,7 @@ test_expect_success 'Q: verify third notes commit' '
test_cmp expect actual
'
-cat >expect.unsorted <<EOF
+cat >expect.unsorted <<-EOF &&
100644 blob $commit1
EOF
cat expect.unsorted | sort >expect
@@ -2029,7 +2029,7 @@ test_expect_success 'Q: verify third note for first commit' '
test_cmp expect actual
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
parent `git rev-parse --verify refs/notes/foobar^`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -2041,7 +2041,7 @@ test_expect_success 'Q: verify fourth notes commit' '
test_cmp expect actual
'
-cat >expect.unsorted <<EOF
+cat >expect.unsorted <<-EOF &&
100644 blob $commit2
EOF
cat expect.unsorted | sort >expect
@@ -2056,7 +2056,7 @@ test_expect_success 'Q: verify second note for second commit' '
test_cmp expect actual
'
-cat >input <<EOF
+cat >input <<-EOF &&
reset refs/heads/Q0
commit refs/heads/note-Q0
@@ -2077,7 +2077,7 @@ test_expect_success 'Q: deny note on empty branch' '
### series R (feature and option)
###
-cat >input <<EOF
+cat >input <<-EOF &&
feature no-such-feature-exists
EOF
@@ -2085,7 +2085,7 @@ test_expect_success 'R: abort on unsupported feature' '
test_must_fail git fast-import <input
'
-cat >input <<EOF
+cat >input <<-EOF &&
feature date-format=now
EOF
@@ -2093,7 +2093,7 @@ test_expect_success 'R: supported feature is accepted' '
git fast-import <input
'
-cat >input << EOF
+cat >input <<-EOF &&
blob
data 3
hi
@@ -2104,7 +2104,7 @@ test_expect_success 'R: abort on receiving feature after data command' '
test_must_fail git fast-import <input
'
-cat >input << EOF
+cat >input <<-EOF &&
feature import-marks=git.marks
feature import-marks=git2.marks
EOF
@@ -2113,7 +2113,7 @@ test_expect_success 'R: only one import-marks feature allowed per stream' '
test_must_fail git fast-import <input
'
-cat >input << EOF
+cat >input <<-EOF &&
feature export-marks=git.marks
blob
mark :1
@@ -2234,7 +2234,7 @@ test_expect_success 'R: feature import-marks-if-exists' '
test_cmp expect io.marks
'
-cat >input << EOF
+cat >input <<-EOF &&
feature import-marks=marks.out
feature export-marks=marks.new
EOF
@@ -2244,7 +2244,7 @@ test_expect_success 'R: import to output marks works without any content' '
test_cmp marks.out marks.new
'
-cat >input <<EOF
+cat >input <<-EOF &&
feature import-marks=nonexistent.marks
feature export-marks=marks.new
EOF
@@ -2255,7 +2255,7 @@ test_expect_success 'R: import marks prefers commandline marks file over the str
'
-cat >input <<EOF
+cat >input <<-EOF &&
feature import-marks=nonexistent.marks
feature export-marks=combined.marks
EOF
@@ -2267,7 +2267,7 @@ test_expect_success 'R: multiple --import-marks= should be honoured' '
test_cmp marks.out combined.marks
'
-cat >input <<EOF
+cat >input <<-EOF &&
feature relative-marks
feature import-marks=relative.in
feature export-marks=relative.out
@@ -2280,7 +2280,7 @@ test_expect_success 'R: feature relative-marks should be honoured' '
test_cmp marks.new .git/info/fast-import/relative.out
'
-cat >input <<EOF
+cat >input <<-EOF &&
feature relative-marks
feature import-marks=relative.in
feature no-relative-marks
@@ -2549,7 +2549,7 @@ test_expect_success PIPE 'R: print staged blob within commit' '
test_cmp expect actual
'
-cat >input << EOF
+cat >input <<-EOF &&
option git quiet
blob
data 3
@@ -2604,7 +2604,7 @@ test_expect_success 'R: terminating "done" within commit' '
test_cmp expect actual
'
-cat >input <<EOF
+cat >input <<-EOF &&
option git non-existing-option
EOF
@@ -2624,7 +2624,7 @@ test_expect_success 'R: die on invalid option argument' '
test_must_fail git fast-import --depth="5 elephants" </dev/null
'
-cat >input <<EOF
+cat >input <<-EOF &&
option non-existing-vcs non-existing-option
EOF
@@ -2637,7 +2637,7 @@ test_expect_success 'R: ignore non-git options' '
##
blobsize=$((2*1024*1024 + 53))
test-genrandom bar $blobsize >expect
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/big-file
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -2648,7 +2648,7 @@ M 644 inline big1
data $blobsize
INPUT_END
cat expect >>input
-cat >>input <<INPUT_END
+cat >>input <<-INPUT_END &&
M 644 inline big2
data $blobsize
INPUT_END
@@ -2713,7 +2713,7 @@ test_expect_success 'R: blob appears only once' '
#
test_tick
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/S
mark :301
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
@@ -3002,7 +3002,7 @@ test_expect_success 'T: empty reset doesnt delete branch' '
### series U (filedelete)
###
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/U
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -3027,7 +3027,7 @@ test_expect_success 'U: initialize for U tests' '
git fast-import <input
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/U
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -3042,7 +3042,7 @@ test_expect_success 'U: filedelete file succeeds' '
git fast-import <input
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
EOF
@@ -3052,7 +3052,7 @@ test_expect_success 'U: validate file delete result' '
compare_diff_raw expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/U
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -3067,7 +3067,7 @@ test_expect_success 'U: filedelete directory succeeds' '
git fast-import <input
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
EOF
@@ -3077,7 +3077,7 @@ test_expect_success 'U: validate directory delete result' '
compare_diff_raw expect actual
'
-cat >input <<INPUT_END
+cat >input <<-INPUT_END &&
commit refs/heads/U
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
@@ -3092,7 +3092,7 @@ test_expect_success 'U: filedelete root succeeds' '
git fast-import <input
'
-cat >expect <<EOF
+cat >expect <<-EOF &&
:100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
EOF
--
2.6.2.337.ga235d84
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 7/7] modernize t9300: move test preparations into test_expect_success
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
` (5 preceding siblings ...)
2015-11-19 19:09 ` [PATCH 6/7] modernize t9300: mark here-doc words to ignore tab indentation Johannes Sixt
@ 2015-11-19 19:09 ` Johannes Sixt
2015-11-20 3:54 ` [PATCH 0/7] Modernize t9300-fast-import Eric Sunshine
7 siblings, 0 replies; 10+ messages in thread
From: Johannes Sixt @ 2015-11-19 19:09 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
Our usual style these days is to execute everything inside
test_expect_success. Make it so.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9300-fast-import.sh | 2580 ++++++++++++++++++++++++------------------------
1 file changed, 1297 insertions(+), 1283 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 7586f41..14a9384 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -51,54 +51,53 @@ echo "$@"'
### series A
###
-test_tick
-
test_expect_success 'empty stream succeeds' '
git fast-import </dev/null
'
-cat >input <<-INPUT_END &&
-blob
-mark :2
-data <<EOF
-$file2_data
-EOF
-
-blob
-mark :3
-data <<END
-$file3_data
-END
-
-blob
-mark :4
-data $file4_len
-$file4_data
-commit refs/heads/master
-mark :5
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-initial
-COMMIT
-
-M 644 :2 file2
-M 644 :3 file3
-M 755 :4 file4
-
-tag series-A
-from :5
-data <<EOF
-An annotated tag without a tagger
-EOF
-
-tag series-A-blob
-from :3
-data <<EOF
-An annotated tag that annotates a blob.
-EOF
-
-INPUT_END
test_expect_success 'A: create pack from stdin' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ blob
+ mark :2
+ data <<EOF
+ $file2_data
+ EOF
+
+ blob
+ mark :3
+ data <<END
+ $file3_data
+ END
+
+ blob
+ mark :4
+ data $file4_len
+ $file4_data
+ commit refs/heads/master
+ mark :5
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ initial
+ COMMIT
+
+ M 644 :2 file2
+ M 644 :3 file3
+ M 755 :4 file4
+
+ tag series-A
+ from :5
+ data <<EOF
+ An annotated tag without a tagger
+ EOF
+
+ tag series-A-blob
+ from :3
+ data <<EOF
+ An annotated tag that annotates a blob.
+ EOF
+
+ INPUT_END
git fast-import --export-marks=marks.out <input &&
git whatchanged master
'
@@ -107,76 +106,76 @@ test_expect_success 'A: verify pack' '
verify_packs
'
-cat >expect <<-EOF &&
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-initial
-EOF
test_expect_success 'A: verify commit' '
+ cat >expect <<-EOF &&
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ initial
+ EOF
git cat-file commit master | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-100644 blob file2
-100644 blob file3
-100755 blob file4
-EOF
test_expect_success 'A: verify tree' '
+ cat >expect <<-EOF &&
+ 100644 blob file2
+ 100644 blob file3
+ 100755 blob file4
+ EOF
git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual
'
-echo "$file2_data" >expect
test_expect_success 'A: verify file2' '
+ echo "$file2_data" >expect &&
git cat-file blob master:file2 >actual &&
test_cmp expect actual
'
-echo "$file3_data" >expect
test_expect_success 'A: verify file3' '
+ echo "$file3_data" >expect &&
git cat-file blob master:file3 >actual &&
test_cmp expect actual
'
-printf "$file4_data" >expect
test_expect_success 'A: verify file4' '
+ printf "$file4_data" >expect &&
git cat-file blob master:file4 >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-object $(git rev-parse refs/heads/master)
-type commit
-tag series-A
-
-An annotated tag without a tagger
-EOF
test_expect_success 'A: verify tag/series-A' '
+ cat >expect <<-EOF &&
+ object $(git rev-parse refs/heads/master)
+ type commit
+ tag series-A
+
+ An annotated tag without a tagger
+ EOF
git cat-file tag tags/series-A >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-object $(git rev-parse refs/heads/master:file3)
-type blob
-tag series-A-blob
-
-An annotated tag that annotates a blob.
-EOF
test_expect_success 'A: verify tag/series-A-blob' '
+ cat >expect <<-EOF &&
+ object $(git rev-parse refs/heads/master:file3)
+ type blob
+ tag series-A-blob
+
+ An annotated tag that annotates a blob.
+ EOF
git cat-file tag tags/series-A-blob >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-:2 `git rev-parse --verify master:file2`
-:3 `git rev-parse --verify master:file3`
-:4 `git rev-parse --verify master:file4`
-:5 `git rev-parse --verify master^0`
-EOF
test_expect_success 'A: verify marks output' '
+ cat >expect <<-EOF &&
+ :2 `git rev-parse --verify master:file2`
+ :3 `git rev-parse --verify master:file3`
+ :4 `git rev-parse --verify master:file4`
+ :5 `git rev-parse --verify master^0`
+ EOF
test_cmp expect marks.out
'
@@ -188,68 +187,69 @@ test_expect_success 'A: verify marks import' '
test_cmp expect marks.new
'
-test_tick
-new_blob=$(echo testing | git hash-object --stdin)
-cat >input <<-INPUT_END &&
-tag series-A-blob-2
-from $(git rev-parse refs/heads/master:file3)
-data <<EOF
-Tag blob by sha1.
-EOF
-
-blob
-mark :6
-data <<EOF
-testing
-EOF
-
-commit refs/heads/new_blob
-committer <> 0 +0000
-data 0
-M 644 :6 new_blob
-#pretend we got sha1 from fast-import
-ls "new_blob"
-
-tag series-A-blob-3
-from $new_blob
-data <<EOF
-Tag new_blob.
-EOF
-INPUT_END
-
-cat >expect <<-EOF &&
-object $(git rev-parse refs/heads/master:file3)
-type blob
-tag series-A-blob-2
-
-Tag blob by sha1.
-object $new_blob
-type blob
-tag series-A-blob-3
-
-Tag new_blob.
-EOF
-
test_expect_success 'A: tag blob by sha1' '
+ test_tick &&
+ new_blob=$(echo testing | git hash-object --stdin) &&
+ cat >input <<-INPUT_END &&
+ tag series-A-blob-2
+ from $(git rev-parse refs/heads/master:file3)
+ data <<EOF
+ Tag blob by sha1.
+ EOF
+
+ blob
+ mark :6
+ data <<EOF
+ testing
+ EOF
+
+ commit refs/heads/new_blob
+ committer <> 0 +0000
+ data 0
+ M 644 :6 new_blob
+ #pretend we got sha1 from fast-import
+ ls "new_blob"
+
+ tag series-A-blob-3
+ from $new_blob
+ data <<EOF
+ Tag new_blob.
+ EOF
+ INPUT_END
+
+ cat >expect <<-EOF &&
+ object $(git rev-parse refs/heads/master:file3)
+ type blob
+ tag series-A-blob-2
+
+ Tag blob by sha1.
+ object $new_blob
+ type blob
+ tag series-A-blob-3
+
+ Tag new_blob.
+ EOF
+
git fast-import <input &&
git cat-file tag tags/series-A-blob-2 >actual &&
git cat-file tag tags/series-A-blob-3 >>actual &&
test_cmp expect actual
'
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/verify--import-marks
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-recreate from :5
-COMMIT
+test_expect_success 'A: verify marks import does not crash' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/verify--import-marks
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ recreate from :5
+ COMMIT
+
+ from :5
+ M 755 :2 copy-of-file2
-from :5
-M 755 :2 copy-of-file2
+ INPUT_END
-INPUT_END
-test_expect_success 'A: verify marks import does not crash' '
git fast-import --import-marks=marks.out <input &&
git whatchanged verify--import-marks
'
@@ -258,68 +258,66 @@ test_expect_success 'A: verify pack' '
verify_packs
'
-cat >expect <<-EOF &&
-:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
-EOF
-git diff-tree -M -r master verify--import-marks >actual
test_expect_success 'A: verify diff' '
+ cat >expect <<-EOF &&
+ :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
+ EOF
+ git diff-tree -M -r master verify--import-marks >actual &&
compare_diff_raw expect actual &&
test `git rev-parse --verify master:file2` \
= `git rev-parse --verify verify--import-marks:copy-of-file2`
'
-test_tick
-mt=$(git hash-object --stdin < /dev/null)
-: >input.blob
-: >marks.exp
-: >tree.exp
-
-cat >input.commit <<-EOF &&
-commit refs/heads/verify--dump-marks
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-test the sparse array dumping routines with exponentially growing marks
-COMMIT
-EOF
-
-i=0
-l=4
-m=6
-n=7
-while test "$i" -lt 27; do
- cat >>input.blob <<-EOF &&
-blob
-mark :$l
-data 0
-blob
-mark :$m
-data 0
-blob
-mark :$n
-data 0
-EOF
- echo "M 100644 :$l l$i" >>input.commit
- echo "M 100644 :$m m$i" >>input.commit
- echo "M 100644 :$n n$i" >>input.commit
-
- echo ":$l $mt" >>marks.exp
- echo ":$m $mt" >>marks.exp
- echo ":$n $mt" >>marks.exp
-
- printf "100644 blob $mt\tl$i\n" >>tree.exp
- printf "100644 blob $mt\tm$i\n" >>tree.exp
- printf "100644 blob $mt\tn$i\n" >>tree.exp
-
- l=$(($l + $l))
- m=$(($m + $m))
- n=$(($l + $n))
-
- i=$((1 + $i))
-done
-
-sort tree.exp > tree.exp_s
-
test_expect_success 'A: export marks with large values' '
+ test_tick &&
+ mt=$(git hash-object --stdin < /dev/null) &&
+ >input.blob &&
+ >marks.exp &&
+ >tree.exp &&
+
+ cat >input.commit <<-EOF &&
+ commit refs/heads/verify--dump-marks
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ test the sparse array dumping routines with exponentially growing marks
+ COMMIT
+ EOF
+
+ i=0 l=4 m=6 n=7 &&
+ while test "$i" -lt 27
+ do
+ cat >>input.blob <<-EOF &&
+ blob
+ mark :$l
+ data 0
+ blob
+ mark :$m
+ data 0
+ blob
+ mark :$n
+ data 0
+ EOF
+ echo "M 100644 :$l l$i" >>input.commit &&
+ echo "M 100644 :$m m$i" >>input.commit &&
+ echo "M 100644 :$n n$i" >>input.commit &&
+
+ echo ":$l $mt" >>marks.exp &&
+ echo ":$m $mt" >>marks.exp &&
+ echo ":$n $mt" >>marks.exp &&
+
+ printf "100644 blob $mt\tl$i\n" >>tree.exp &&
+ printf "100644 blob $mt\tm$i\n" >>tree.exp &&
+ printf "100644 blob $mt\tn$i\n" >>tree.exp &&
+
+ l=$(($l + $l)) &&
+ m=$(($m + $m)) &&
+ n=$(($l + $n)) &&
+
+ i=$((1 + $i)) || return 1
+ done &&
+
+ sort tree.exp > tree.exp_s &&
+
cat input.blob input.commit | git fast-import --export-marks=marks.large &&
git ls-tree refs/heads/verify--dump-marks >tree.out &&
test_cmp tree.exp_s tree.out &&
@@ -330,35 +328,37 @@ test_expect_success 'A: export marks with large values' '
### series B
###
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/branch
-mark :1
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-corrupt
-COMMIT
+test_expect_success 'B: fail on invalid blob sha1' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/branch
+ mark :1
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ corrupt
+ COMMIT
+
+ from refs/heads/master
+ M 755 0000000000000000000000000000000000000001 zero1
-from refs/heads/master
-M 755 0000000000000000000000000000000000000001 zero1
+ INPUT_END
-INPUT_END
-test_expect_success 'B: fail on invalid blob sha1' '
test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
test_must_fail git fast-import <input
'
-cat >input <<-INPUT_END &&
-commit TEMP_TAG
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-tag base
-COMMIT
+test_expect_success 'B: accept branch name "TEMP_TAG"' '
+ cat >input <<-INPUT_END &&
+ commit TEMP_TAG
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ tag base
+ COMMIT
+
+ from refs/heads/master
-from refs/heads/master
+ INPUT_END
-INPUT_END
-test_expect_success 'B: accept branch name "TEMP_TAG"' '
test_when_finished "rm -f .git/TEMP_TAG
git gc
git prune" &&
@@ -367,14 +367,15 @@ test_expect_success 'B: accept branch name "TEMP_TAG"' '
test `git rev-parse master` = `git rev-parse TEMP_TAG^`
'
-cat >input <<-INPUT_END &&
-commit refs/heads/empty-committer-1
-committer <> $GIT_COMMITTER_DATE
-data <<COMMIT
-empty commit
-COMMIT
-INPUT_END
test_expect_success 'B: accept empty committer' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/empty-committer-1
+ committer <> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
test_when_finished "git update-ref -d refs/heads/empty-committer-1
git gc
git prune" &&
@@ -384,14 +385,15 @@ test_expect_success 'B: accept empty committer' '
test -z "$out"
'
-cat >input <<-INPUT_END &&
-commit refs/heads/empty-committer-2
-committer <a@b.com> $GIT_COMMITTER_DATE
-data <<COMMIT
-empty commit
-COMMIT
-INPUT_END
test_expect_success 'B: accept and fixup committer with no name' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/empty-committer-2
+ committer <a@b.com> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
test_when_finished "git update-ref -d refs/heads/empty-committer-2
git gc
git prune" &&
@@ -401,62 +403,67 @@ test_expect_success 'B: accept and fixup committer with no name' '
test -z "$out"
'
-cat >input <<-INPUT_END &&
-commit refs/heads/invalid-committer
-committer Name email> $GIT_COMMITTER_DATE
-data <<COMMIT
-empty commit
-COMMIT
-INPUT_END
test_expect_success 'B: fail on invalid committer (1)' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/invalid-committer
+ committer Name email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-cat >input <<-INPUT_END &&
-commit refs/heads/invalid-committer
-committer Name <e<mail> $GIT_COMMITTER_DATE
-data <<COMMIT
-empty commit
-COMMIT
-INPUT_END
test_expect_success 'B: fail on invalid committer (2)' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/invalid-committer
+ committer Name <e<mail> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-cat >input <<-INPUT_END &&
-commit refs/heads/invalid-committer
-committer Name <email>> $GIT_COMMITTER_DATE
-data <<COMMIT
-empty commit
-COMMIT
-INPUT_END
test_expect_success 'B: fail on invalid committer (3)' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/invalid-committer
+ committer Name <email>> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-cat >input <<-INPUT_END &&
-commit refs/heads/invalid-committer
-committer Name <email $GIT_COMMITTER_DATE
-data <<COMMIT
-empty commit
-COMMIT
-INPUT_END
test_expect_success 'B: fail on invalid committer (4)' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/invalid-committer
+ committer Name <email $GIT_COMMITTER_DATE
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
-cat >input <<-INPUT_END &&
-commit refs/heads/invalid-committer
-committer Name<email> $GIT_COMMITTER_DATE
-data <<COMMIT
-empty commit
-COMMIT
-INPUT_END
test_expect_success 'B: fail on invalid committer (5)' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/invalid-committer
+ committer Name<email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ empty commit
+ COMMIT
+ INPUT_END
+
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
test_must_fail git fast-import <input
'
@@ -465,23 +472,24 @@ test_expect_success 'B: fail on invalid committer (5)' '
### series C
###
-newf=`echo hi newf | git hash-object -w --stdin`
-oldf=`git rev-parse --verify master:file2`
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/branch
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-second
-COMMIT
-
-from refs/heads/master
-M 644 $oldf file2/oldf
-M 755 $newf file2/newf
-D file3
-
-INPUT_END
test_expect_success 'C: incremental import create pack from stdin' '
+ newf=`echo hi newf | git hash-object -w --stdin` &&
+ oldf=`git rev-parse --verify master:file2` &&
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/branch
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ second
+ COMMIT
+
+ from refs/heads/master
+ M 644 $oldf file2/oldf
+ M 755 $newf file2/newf
+ D file3
+
+ INPUT_END
+
git fast-import <input &&
git whatchanged branch
'
@@ -495,25 +503,26 @@ test_expect_success 'C: validate reuse existing blob' '
test $oldf = `git rev-parse --verify branch:file2/oldf`
'
-cat >expect <<-EOF &&
-parent `git rev-parse --verify master^0`
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-second
-EOF
test_expect_success 'C: verify commit' '
+ cat >expect <<-EOF &&
+ parent `git rev-parse --verify master^0`
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ second
+ EOF
+
git cat-file commit branch | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
-:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
-EOF
-git diff-tree -M -r master branch >actual
test_expect_success 'C: validate rename result' '
+ cat >expect <<-EOF &&
+ :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
+ :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
+ :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
+ EOF
+ git diff-tree -M -r master branch >actual &&
compare_diff_raw expect actual
'
@@ -521,27 +530,28 @@ test_expect_success 'C: validate rename result' '
### series D
###
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/branch
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-third
-COMMIT
-
-from refs/heads/branch^0
-M 644 inline newdir/interesting
-data <<EOF
-$file5_data
-EOF
-
-M 755 inline newdir/exec.sh
-data <<EOF
-$file6_data
-EOF
-
-INPUT_END
test_expect_success 'D: inline data in commit' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/branch
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ third
+ COMMIT
+
+ from refs/heads/branch^0
+ M 644 inline newdir/interesting
+ data <<EOF
+ $file5_data
+ EOF
+
+ M 755 inline newdir/exec.sh
+ data <<EOF
+ $file6_data
+ EOF
+
+ INPUT_END
+
git fast-import <input &&
git whatchanged branch
'
@@ -550,23 +560,23 @@ test_expect_success 'D: verify pack' '
verify_packs
'
-cat >expect <<-EOF &&
-:000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
-:000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
-EOF
-git diff-tree -M -r branch^ branch >actual
test_expect_success 'D: validate new files added' '
+ cat >expect <<-EOF &&
+ :000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
+ :000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
+ EOF
+ git diff-tree -M -r branch^ branch >actual &&
compare_diff_raw expect actual
'
-echo "$file5_data" >expect
test_expect_success 'D: verify file5' '
+ echo "$file5_data" >expect &&
git cat-file blob branch:newdir/interesting >actual &&
test_cmp expect actual
'
-echo "$file6_data" >expect
test_expect_success 'D: verify file6' '
+ echo "$file6_data" >expect &&
git cat-file blob branch:newdir/exec.sh >actual &&
test_cmp expect actual
'
@@ -575,18 +585,19 @@ test_expect_success 'D: verify file6' '
### series E
###
-cat >input <<-INPUT_END &&
-commit refs/heads/branch
-author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
-data <<COMMIT
-RFC 2822 type date
-COMMIT
+test_expect_success 'E: rfc2822 date, --date-format=raw' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/branch
+ author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
+ data <<COMMIT
+ RFC 2822 type date
+ COMMIT
+
+ from refs/heads/branch^0
-from refs/heads/branch^0
+ INPUT_END
-INPUT_END
-test_expect_success 'E: rfc2822 date, --date-format=raw' '
test_must_fail git fast-import --date-format=raw <input
'
test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '
@@ -597,13 +608,13 @@ test_expect_success 'E: verify pack' '
verify_packs
'
-cat >expect <<-EOF &&
-author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
-
-RFC 2822 type date
-EOF
test_expect_success 'E: verify commit' '
+ cat >expect <<-EOF &&
+ author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
+
+ RFC 2822 type date
+ EOF
git cat-file commit branch | sed 1,2d >actual &&
test_cmp expect actual
'
@@ -612,22 +623,23 @@ test_expect_success 'E: verify commit' '
### series F
###
-old_branch=`git rev-parse --verify branch^0`
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/branch
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-losing things already?
-COMMIT
+test_expect_success 'F: non-fast-forward update skips' '
+ old_branch=`git rev-parse --verify branch^0` &&
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/branch
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ losing things already?
+ COMMIT
-from refs/heads/branch~1
+ from refs/heads/branch~1
-reset refs/heads/other
-from refs/heads/branch
+ reset refs/heads/other
+ from refs/heads/branch
+
+ INPUT_END
-INPUT_END
-test_expect_success 'F: non-fast-forward update skips' '
test_must_fail git fast-import <input &&
# branch must remain unaffected
test $old_branch = `git rev-parse --verify branch^0`
@@ -637,15 +649,15 @@ test_expect_success 'F: verify pack' '
verify_packs
'
-cat >expect <<-EOF &&
-tree `git rev-parse branch~1^{tree}`
-parent `git rev-parse branch~1`
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-losing things already?
-EOF
test_expect_success 'F: verify other commit' '
+ cat >expect <<-EOF &&
+ tree `git rev-parse branch~1^{tree}`
+ parent `git rev-parse branch~1`
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ losing things already?
+ EOF
git cat-file commit other >actual &&
test_cmp expect actual
'
@@ -654,19 +666,19 @@ test_expect_success 'F: verify other commit' '
### series G
###
-old_branch=`git rev-parse --verify branch^0`
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/branch
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-losing things already?
-COMMIT
+test_expect_success 'G: non-fast-forward update forced' '
+ old_branch=`git rev-parse --verify branch^0` &&
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/branch
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ losing things already?
+ COMMIT
-from refs/heads/branch~1
+ from refs/heads/branch~1
-INPUT_END
-test_expect_success 'G: non-fast-forward update forced' '
+ INPUT_END
git fast-import --force <input
'
@@ -683,28 +695,28 @@ test_expect_success 'G: branch changed, but logged' '
### series H
###
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/H
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-third
-COMMIT
-
-from refs/heads/branch^0
-M 644 inline i-will-die
-data <<EOF
-this file will never exist.
-EOF
-
-deleteall
-M 644 inline h/e/l/lo
-data <<EOF
-$file5_data
-EOF
-
-INPUT_END
test_expect_success 'H: deletall, add 1' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/H
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ third
+ COMMIT
+
+ from refs/heads/branch^0
+ M 644 inline i-will-die
+ data <<EOF
+ this file will never exist.
+ EOF
+
+ deleteall
+ M 644 inline h/e/l/lo
+ data <<EOF
+ $file5_data
+ EOF
+
+ INPUT_END
git fast-import <input &&
git whatchanged H
'
@@ -713,20 +725,20 @@ test_expect_success 'H: verify pack' '
verify_packs
'
-cat >expect <<-EOF &&
-:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
-:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
-:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
-:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
-EOF
-git diff-tree -M -r H^ H >actual
test_expect_success 'H: validate old files removed, new files added' '
+ cat >expect <<-EOF &&
+ :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
+ :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
+ :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
+ :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
+ :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
+ EOF
+ git diff-tree -M -r H^ H >actual &&
compare_diff_raw expect actual
'
-echo "$file5_data" >expect
test_expect_success 'H: verify file' '
+ echo "$file5_data" >expect &&
git cat-file blob H:h/e/l/lo >actual &&
test_cmp expect actual
'
@@ -735,24 +747,24 @@ test_expect_success 'H: verify file' '
### series I
###
-cat >input <<-INPUT_END &&
-commit refs/heads/export-boundary
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-we have a border. its only 40 characters wide.
-COMMIT
+test_expect_success 'I: export-pack-edges' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/export-boundary
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ we have a border. its only 40 characters wide.
+ COMMIT
-from refs/heads/branch
+ from refs/heads/branch
-INPUT_END
-test_expect_success 'I: export-pack-edges' '
+ INPUT_END
git fast-import --export-pack-edges=edges.list <input
'
-cat >expect <<-EOF &&
-.git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
-EOF
test_expect_success 'I: verify edge list' '
+ cat >expect <<-EOF &&
+ .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
+ EOF
sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
test_cmp expect actual
'
@@ -761,25 +773,25 @@ test_expect_success 'I: verify edge list' '
### series J
###
-cat >input <<-INPUT_END &&
-commit refs/heads/J
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-create J
-COMMIT
+test_expect_success 'J: reset existing branch creates empty commit' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/J
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ create J
+ COMMIT
-from refs/heads/branch
+ from refs/heads/branch
-reset refs/heads/J
+ reset refs/heads/J
-commit refs/heads/J
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-initialize J
-COMMIT
+ commit refs/heads/J
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ initialize J
+ COMMIT
-INPUT_END
-test_expect_success 'J: reset existing branch creates empty commit' '
+ INPUT_END
git fast-import <input
'
test_expect_success 'J: branch has 1 commit, empty tree' '
@@ -787,41 +799,42 @@ test_expect_success 'J: branch has 1 commit, empty tree' '
test 0 = `git ls-tree J | wc -l`
'
-cat >input <<-INPUT_END &&
-reset refs/heads/J2
-
-tag wrong_tag
-from refs/heads/J2
-data <<EOF
-Tag branch that was reset.
-EOF
-INPUT_END
test_expect_success 'J: tag must fail on empty branch' '
+ cat >input <<-INPUT_END &&
+ reset refs/heads/J2
+
+ tag wrong_tag
+ from refs/heads/J2
+ data <<EOF
+ Tag branch that was reset.
+ EOF
+ INPUT_END
test_must_fail git fast-import <input
'
+
###
### series K
###
-cat >input <<-INPUT_END &&
-commit refs/heads/K
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-create K
-COMMIT
+test_expect_success 'K: reinit branch with from' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/K
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ create K
+ COMMIT
-from refs/heads/branch
+ from refs/heads/branch
-commit refs/heads/K
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-redo K
-COMMIT
+ commit refs/heads/K
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ redo K
+ COMMIT
-from refs/heads/branch^1
+ from refs/heads/branch^1
-INPUT_END
-test_expect_success 'K: reinit branch with from' '
+ INPUT_END
git fast-import <input
'
test_expect_success 'K: verify K^1 = branch^1' '
@@ -833,84 +846,84 @@ test_expect_success 'K: verify K^1 = branch^1' '
### series L
###
-cat >input <<-INPUT_END &&
-blob
-mark :1
-data <<EOF
-some data
-EOF
-
-blob
-mark :2
-data <<EOF
-other data
-EOF
-
-commit refs/heads/L
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-create L
-COMMIT
-
-M 644 :1 b.
-M 644 :1 b/other
-M 644 :1 ba
-
-commit refs/heads/L
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-update L
-COMMIT
-
-M 644 :2 b.
-M 644 :2 b/other
-M 644 :2 ba
-INPUT_END
-
-cat >expect <<-EXPECT_END &&
-:100644 100644 4268632... 55d3a52... M b.
-:040000 040000 0ae5cac... 443c768... M b
-:100644 100644 4268632... 55d3a52... M ba
-EXPECT_END
+test_expect_success 'L: verify internal tree sorting' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<EOF
+ some data
+ EOF
+
+ blob
+ mark :2
+ data <<EOF
+ other data
+ EOF
+
+ commit refs/heads/L
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ create L
+ COMMIT
+
+ M 644 :1 b.
+ M 644 :1 b/other
+ M 644 :1 ba
+
+ commit refs/heads/L
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ update L
+ COMMIT
+
+ M 644 :2 b.
+ M 644 :2 b/other
+ M 644 :2 ba
+ INPUT_END
+
+ cat >expect <<-EXPECT_END &&
+ :100644 100644 4268632... 55d3a52... M b.
+ :040000 040000 0ae5cac... 443c768... M b
+ :100644 100644 4268632... 55d3a52... M ba
+ EXPECT_END
+
+ git fast-import <input &&
+ git diff-tree --abbrev --raw L^ L >output &&
+ test_cmp expect output
+'
+
+test_expect_success 'L: nested tree copy does not corrupt deltas' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<EOF
+ the data
+ EOF
+
+ commit refs/heads/L2
+ committer C O Mitter <committer@example.com> 1112912473 -0700
+ data <<COMMIT
+ init L2
+ COMMIT
+ M 644 :1 a/b/c
+ M 644 :1 a/b/d
+ M 644 :1 a/e/f
-test_expect_success 'L: verify internal tree sorting' '
- git fast-import <input &&
- git diff-tree --abbrev --raw L^ L >output &&
- test_cmp expect output
-'
+ commit refs/heads/L2
+ committer C O Mitter <committer@example.com> 1112912473 -0700
+ data <<COMMIT
+ update L2
+ COMMIT
+ C a g
+ C a/e g/b
+ M 644 :1 g/b/h
+ INPUT_END
-cat >input <<-INPUT_END &&
-blob
-mark :1
-data <<EOF
-the data
-EOF
-
-commit refs/heads/L2
-committer C O Mitter <committer@example.com> 1112912473 -0700
-data <<COMMIT
-init L2
-COMMIT
-M 644 :1 a/b/c
-M 644 :1 a/b/d
-M 644 :1 a/e/f
-
-commit refs/heads/L2
-committer C O Mitter <committer@example.com> 1112912473 -0700
-data <<COMMIT
-update L2
-COMMIT
-C a g
-C a/e g/b
-M 644 :1 g/b/h
-INPUT_END
-
-cat <<-EOF >expect &&
-g/b/f
-g/b/h
-EOF
+ cat >expect <<-\EOF &&
+ g/b/f
+ g/b/h
+ EOF
-test_expect_success 'L: nested tree copy does not corrupt deltas' '
test_when_finished "git update-ref -d refs/heads/L2" &&
git fast-import <input &&
git ls-tree L2 g/b/ >tmp &&
@@ -923,90 +936,90 @@ test_expect_success 'L: nested tree copy does not corrupt deltas' '
### series M
###
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/M1
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-file rename
-COMMIT
+test_expect_success 'M: rename file in same subdirectory' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/M1
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ file rename
+ COMMIT
-from refs/heads/branch^0
-R file2/newf file2/n.e.w.f
+ from refs/heads/branch^0
+ R file2/newf file2/n.e.w.f
-INPUT_END
+ INPUT_END
-cat >expect <<-EOF &&
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
-EOF
-test_expect_success 'M: rename file in same subdirectory' '
+ cat >expect <<-EOF &&
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
+ EOF
git fast-import <input &&
git diff-tree -M -r M1^ M1 >actual &&
compare_diff_raw expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/M2
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-file rename
-COMMIT
+test_expect_success 'M: rename file to new subdirectory' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/M2
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ file rename
+ COMMIT
-from refs/heads/branch^0
-R file2/newf i/am/new/to/you
+ from refs/heads/branch^0
+ R file2/newf i/am/new/to/you
-INPUT_END
+ INPUT_END
-cat >expect <<-EOF &&
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
-EOF
-test_expect_success 'M: rename file to new subdirectory' '
+ cat >expect <<-EOF &&
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
+ EOF
git fast-import <input &&
git diff-tree -M -r M2^ M2 >actual &&
compare_diff_raw expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/M3
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-file rename
-COMMIT
+test_expect_success 'M: rename subdirectory to new subdirectory' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/M3
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ file rename
+ COMMIT
-from refs/heads/M2^0
-R i other/sub
+ from refs/heads/M2^0
+ R i other/sub
-INPUT_END
+ INPUT_END
-cat >expect <<-EOF &&
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
-EOF
-test_expect_success 'M: rename subdirectory to new subdirectory' '
+ cat >expect <<-EOF &&
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
+ EOF
git fast-import <input &&
git diff-tree -M -r M3^ M3 >actual &&
compare_diff_raw expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/M4
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-rename root
-COMMIT
+test_expect_success 'M: rename root to subdirectory' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/M4
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ rename root
+ COMMIT
-from refs/heads/M2^0
-R "" sub
+ from refs/heads/M2^0
+ R "" sub
-INPUT_END
+ INPUT_END
-cat >expect <<-EOF &&
-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
-:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
-:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
-EOF
-test_expect_success 'M: rename root to subdirectory' '
+ cat >expect <<-EOF &&
+ :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
+ :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
+ :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
+ :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
+ EOF
git fast-import <input &&
git diff-tree -M -r M4^ M4 >actual &&
cat actual &&
@@ -1017,81 +1030,81 @@ test_expect_success 'M: rename root to subdirectory' '
### series N
###
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/N1
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-file copy
-COMMIT
+test_expect_success 'N: copy file in same subdirectory' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/N1
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ file copy
+ COMMIT
-from refs/heads/branch^0
-C file2/newf file2/n.e.w.f
+ from refs/heads/branch^0
+ C file2/newf file2/n.e.w.f
-INPUT_END
+ INPUT_END
-cat >expect <<-EOF &&
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
-EOF
-test_expect_success 'N: copy file in same subdirectory' '
+ cat >expect <<-EOF &&
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
+ EOF
git fast-import <input &&
git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
compare_diff_raw expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/N2
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-clean directory copy
-COMMIT
+test_expect_success 'N: copy then modify subdirectory' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/N2
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ clean directory copy
+ COMMIT
-from refs/heads/branch^0
-C file2 file3
+ from refs/heads/branch^0
+ C file2 file3
-commit refs/heads/N2
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-modify directory copy
-COMMIT
+ commit refs/heads/N2
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ modify directory copy
+ COMMIT
-M 644 inline file3/file5
-data <<EOF
-$file5_data
-EOF
+ M 644 inline file3/file5
+ data <<EOF
+ $file5_data
+ EOF
-INPUT_END
+ INPUT_END
-cat >expect <<-EOF &&
-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
-EOF
-test_expect_success 'N: copy then modify subdirectory' '
+ cat >expect <<-EOF &&
+ :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
+ :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
+ EOF
git fast-import <input &&
git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
compare_diff_raw expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/N3
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-dirty directory copy
-COMMIT
+test_expect_success 'N: copy dirty subdirectory' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/N3
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ dirty directory copy
+ COMMIT
-from refs/heads/branch^0
-M 644 inline file2/file5
-data <<EOF
-$file5_data
-EOF
+ from refs/heads/branch^0
+ M 644 inline file2/file5
+ data <<EOF
+ $file5_data
+ EOF
-C file2 file3
-D file2/file5
+ C file2 file3
+ D file2/file5
-INPUT_END
+ INPUT_END
-test_expect_success 'N: copy dirty subdirectory' '
git fast-import <input &&
test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`
'
@@ -1457,59 +1470,59 @@ test_expect_success 'N: modify subtree, extract it, and modify again' '
### series O
###
-cat >input <<-INPUT_END &&
-#we will
-commit refs/heads/O1
-# -- ignore all of this text
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-# $GIT_COMMITTER_NAME has inserted here for his benefit.
-data <<COMMIT
-dirty directory copy
-COMMIT
-
-# don't forget the import blank line!
-#
-# yes, we started from our usual base of branch^0.
-# i like branch^0.
-from refs/heads/branch^0
-# and we need to reuse file2/file5 from N3 above.
-M 644 inline file2/file5
-# otherwise the tree will be different
-data <<EOF
-$file5_data
-EOF
-
-# don't forget to copy file2 to file3
-C file2 file3
-#
-# or to delete file5 from file2.
-D file2/file5
-# are we done yet?
+test_expect_success 'O: comments are all skipped' '
+ cat >input <<-INPUT_END &&
+ #we will
+ commit refs/heads/O1
+ # -- ignore all of this text
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ # $GIT_COMMITTER_NAME has inserted here for his benefit.
+ data <<COMMIT
+ dirty directory copy
+ COMMIT
+
+ # do not forget the import blank line!
+ #
+ # yes, we started from our usual base of branch^0.
+ # i like branch^0.
+ from refs/heads/branch^0
+ # and we need to reuse file2/file5 from N3 above.
+ M 644 inline file2/file5
+ # otherwise the tree will be different
+ data <<EOF
+ $file5_data
+ EOF
-INPUT_END
+ # do not forget to copy file2 to file3
+ C file2 file3
+ #
+ # or to delete file5 from file2.
+ D file2/file5
+ # are we done yet?
+
+ INPUT_END
-test_expect_success 'O: comments are all skipped' '
git fast-import <input &&
test `git rev-parse N3` = `git rev-parse O1`
'
-cat >input <<-INPUT_END &&
-commit refs/heads/O2
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-dirty directory copy
-COMMIT
-from refs/heads/branch^0
-M 644 inline file2/file5
-data <<EOF
-$file5_data
-EOF
-C file2 file3
-D file2/file5
+test_expect_success 'O: blank lines not necessary after data commands' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/O2
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ dirty directory copy
+ COMMIT
+ from refs/heads/branch^0
+ M 644 inline file2/file5
+ data <<EOF
+ $file5_data
+ EOF
+ C file2 file3
+ D file2/file5
-INPUT_END
+ INPUT_END
-test_expect_success 'O: blank lines not necessary after data commands' '
git fast-import <input &&
test `git rev-parse N3` = `git rev-parse O2`
'
@@ -1518,43 +1531,44 @@ test_expect_success 'O: repack before next test' '
git repack -a -d
'
-cat >input <<-INPUT_END &&
-commit refs/heads/O3
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zstring
-COMMIT
-commit refs/heads/O3
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zof
-COMMIT
-checkpoint
-commit refs/heads/O3
-mark :5
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zempty
-COMMIT
-checkpoint
-commit refs/heads/O3
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zcommits
-COMMIT
-reset refs/tags/O3-2nd
-from :5
-reset refs/tags/O3-3rd
-from :5
-INPUT_END
-
-cat >expect <<-INPUT_END &&
-string
-of
-empty
-commits
-INPUT_END
test_expect_success 'O: blank lines not necessary after other commands' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/O3
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zstring
+ COMMIT
+ commit refs/heads/O3
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zof
+ COMMIT
+ checkpoint
+ commit refs/heads/O3
+ mark :5
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zempty
+ COMMIT
+ checkpoint
+ commit refs/heads/O3
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zcommits
+ COMMIT
+ reset refs/tags/O3-2nd
+ from :5
+ reset refs/tags/O3-3rd
+ from :5
+ INPUT_END
+
+ cat >expect <<-INPUT_END &&
+ string
+ of
+ empty
+ commits
+ INPUT_END
+
git fast-import <input &&
test 8 = `find .git/objects/pack -type f | wc -l` &&
test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
@@ -1562,319 +1576,319 @@ test_expect_success 'O: blank lines not necessary after other commands' '
test_cmp expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/O4
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zstring
-COMMIT
-commit refs/heads/O4
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zof
-COMMIT
-progress Two commits down, 2 to go!
-commit refs/heads/O4
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zempty
-COMMIT
-progress Three commits down, 1 to go!
-commit refs/heads/O4
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-zcommits
-COMMIT
-progress I'm done!
-INPUT_END
test_expect_success 'O: progress outputs as requested by input' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/O4
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zstring
+ COMMIT
+ commit refs/heads/O4
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zof
+ COMMIT
+ progress Two commits down, 2 to go!
+ commit refs/heads/O4
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zempty
+ COMMIT
+ progress Three commits down, 1 to go!
+ commit refs/heads/O4
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ zcommits
+ COMMIT
+ progress done!
+ INPUT_END
git fast-import <input >actual &&
grep "progress " <input >expect &&
test_cmp expect actual
'
-###
-### series P (gitlinks)
-###
+###
+### series P (gitlinks)
+###
+
+test_expect_success 'P: superproject & submodule mix' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data 10
+ test file
+
+ reset refs/heads/sub
+ commit refs/heads/sub
+ mark :2
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data 12
+ sub_initial
+ M 100644 :1 file
+
+ blob
+ mark :3
+ data <<DATAEND
+ [submodule "sub"]
+ path = sub
+ url = "`pwd`/sub"
+ DATAEND
+
+ commit refs/heads/subuse1
+ mark :4
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data 8
+ initial
+ from refs/heads/master
+ M 100644 :3 .gitmodules
+ M 160000 :2 sub
+
+ blob
+ mark :5
+ data 20
+ test file
+ more data
+
+ commit refs/heads/sub
+ mark :6
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data 11
+ sub_second
+ from :2
+ M 100644 :5 file
+
+ commit refs/heads/subuse1
+ mark :7
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data 7
+ second
+ from :4
+ M 160000 :6 sub
+
+ INPUT_END
+
+ git fast-import <input &&
+ git checkout subuse1 &&
+ rm -rf sub &&
+ mkdir sub &&
+ (
+ cd sub &&
+ git init &&
+ git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
+ git checkout master
+ ) &&
+ git submodule init &&
+ git submodule update
+'
+
+test_expect_success 'P: verbatim SHA gitlinks' '
+ SUBLAST=$(git rev-parse --verify sub) &&
+ SUBPREV=$(git rev-parse --verify sub^) &&
+
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<DATAEND
+ [submodule "sub"]
+ path = sub
+ url = "`pwd`/sub"
+ DATAEND
+
+ commit refs/heads/subuse2
+ mark :2
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data 8
+ initial
+ from refs/heads/master
+ M 100644 :1 .gitmodules
+ M 160000 $SUBPREV sub
+
+ commit refs/heads/subuse2
+ mark :3
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data 7
+ second
+ from :2
+ M 160000 $SUBLAST sub
+
+ INPUT_END
+
+ git branch -D sub &&
+ git gc &&
+ git prune &&
+ git fast-import <input &&
+ test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
+'
+
+test_expect_success 'P: fail on inline gitlink' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/subuse3
+ mark :1
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ corrupt
+ COMMIT
+
+ from refs/heads/subuse2
+ M 160000 inline sub
+ data <<DATA
+ $SUBPREV
+ DATA
+
+ INPUT_END
+
+ test_must_fail git fast-import <input
+'
+
+test_expect_success 'P: fail on blob mark in gitlink' '
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<DATA
+ $SUBPREV
+ DATA
+
+ commit refs/heads/subuse3
+ mark :2
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ corrupt
+ COMMIT
+
+ from refs/heads/subuse2
+ M 160000 :1 sub
+
+ INPUT_END
+
+ test_must_fail git fast-import <input
+'
+
+###
+### series Q (notes)
+###
+
+test_expect_success 'Q: commit notes' '
+ note1_data="The first note for the first commit" &&
+ note2_data="The first note for the second commit" &&
+ note3_data="The first note for the third commit" &&
+ note1b_data="The second note for the first commit" &&
+ note1c_data="The third note for the first commit" &&
+ note2b_data="The second note for the second commit" &&
+
+ test_tick &&
+ cat >input <<-INPUT_END &&
+ blob
+ mark :2
+ data <<EOF
+ $file2_data
+ EOF
+
+ commit refs/heads/notes-test
+ mark :3
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ first (:3)
+ COMMIT
+
+ M 644 :2 file2
-cat >input <<-INPUT_END &&
-blob
-mark :1
-data 10
-test file
-
-reset refs/heads/sub
-commit refs/heads/sub
-mark :2
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data 12
-sub_initial
-M 100644 :1 file
-
-blob
-mark :3
-data <<DATAEND
-[submodule "sub"]
- path = sub
- url = "`pwd`/sub"
-DATAEND
-
-commit refs/heads/subuse1
-mark :4
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data 8
-initial
-from refs/heads/master
-M 100644 :3 .gitmodules
-M 160000 :2 sub
-
-blob
-mark :5
-data 20
-test file
-more data
-
-commit refs/heads/sub
-mark :6
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data 11
-sub_second
-from :2
-M 100644 :5 file
-
-commit refs/heads/subuse1
-mark :7
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data 7
-second
-from :4
-M 160000 :6 sub
-
-INPUT_END
+ blob
+ mark :4
+ data $file4_len
+ $file4_data
+ commit refs/heads/notes-test
+ mark :5
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ second (:5)
+ COMMIT
-test_expect_success 'P: superproject & submodule mix' '
- git fast-import <input &&
- git checkout subuse1 &&
- rm -rf sub &&
- mkdir sub &&
- (
- cd sub &&
- git init &&
- git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
- git checkout master
- ) &&
- git submodule init &&
- git submodule update
-'
+ M 644 :4 file4
-SUBLAST=$(git rev-parse --verify sub)
-SUBPREV=$(git rev-parse --verify sub^)
-
-cat >input <<-INPUT_END &&
-blob
-mark :1
-data <<DATAEND
-[submodule "sub"]
- path = sub
- url = "`pwd`/sub"
-DATAEND
-
-commit refs/heads/subuse2
-mark :2
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data 8
-initial
-from refs/heads/master
-M 100644 :1 .gitmodules
-M 160000 $SUBPREV sub
-
-commit refs/heads/subuse2
-mark :3
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data 7
-second
-from :2
-M 160000 $SUBLAST sub
-
-INPUT_END
+ commit refs/heads/notes-test
+ mark :6
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ third (:6)
+ COMMIT
-test_expect_success 'P: verbatim SHA gitlinks' '
- git branch -D sub &&
- git gc &&
- git prune &&
- git fast-import <input &&
- test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
-'
+ M 644 inline file5
+ data <<EOF
+ $file5_data
+ EOF
-test_tick
-cat >input <<-INPUT_END &&
-commit refs/heads/subuse3
-mark :1
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-corrupt
-COMMIT
+ M 755 inline file6
+ data <<EOF
+ $file6_data
+ EOF
-from refs/heads/subuse2
-M 160000 inline sub
-data <<DATA
-$SUBPREV
-DATA
+ blob
+ mark :7
+ data <<EOF
+ $note1_data
+ EOF
-INPUT_END
+ blob
+ mark :8
+ data <<EOF
+ $note2_data
+ EOF
-test_expect_success 'P: fail on inline gitlink' '
- test_must_fail git fast-import <input
-'
+ commit refs/notes/foobar
+ mark :9
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ notes (:9)
+ COMMIT
-test_tick
-cat >input <<-INPUT_END &&
-blob
-mark :1
-data <<DATA
-$SUBPREV
-DATA
+ N :7 :3
+ N :8 :5
+ N inline :6
+ data <<EOF
+ $note3_data
+ EOF
-commit refs/heads/subuse3
-mark :2
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-corrupt
-COMMIT
+ commit refs/notes/foobar
+ mark :10
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ notes (:10)
+ COMMIT
-from refs/heads/subuse2
-M 160000 :1 sub
+ N inline :3
+ data <<EOF
+ $note1b_data
+ EOF
-INPUT_END
+ commit refs/notes/foobar2
+ mark :11
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ notes (:11)
+ COMMIT
-test_expect_success 'P: fail on blob mark in gitlink' '
- test_must_fail git fast-import <input
-'
+ N inline :3
+ data <<EOF
+ $note1c_data
+ EOF
-###
-### series Q (notes)
-###
+ commit refs/notes/foobar
+ mark :12
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ notes (:12)
+ COMMIT
+
+ deleteall
+ N inline :5
+ data <<EOF
+ $note2b_data
+ EOF
-note1_data="The first note for the first commit"
-note2_data="The first note for the second commit"
-note3_data="The first note for the third commit"
-note1b_data="The second note for the first commit"
-note1c_data="The third note for the first commit"
-note2b_data="The second note for the second commit"
-
-test_tick
-cat >input <<-INPUT_END &&
-blob
-mark :2
-data <<EOF
-$file2_data
-EOF
-
-commit refs/heads/notes-test
-mark :3
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-first (:3)
-COMMIT
-
-M 644 :2 file2
-
-blob
-mark :4
-data $file4_len
-$file4_data
-commit refs/heads/notes-test
-mark :5
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-second (:5)
-COMMIT
-
-M 644 :4 file4
-
-commit refs/heads/notes-test
-mark :6
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-third (:6)
-COMMIT
-
-M 644 inline file5
-data <<EOF
-$file5_data
-EOF
-
-M 755 inline file6
-data <<EOF
-$file6_data
-EOF
-
-blob
-mark :7
-data <<EOF
-$note1_data
-EOF
-
-blob
-mark :8
-data <<EOF
-$note2_data
-EOF
-
-commit refs/notes/foobar
-mark :9
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-notes (:9)
-COMMIT
-
-N :7 :3
-N :8 :5
-N inline :6
-data <<EOF
-$note3_data
-EOF
-
-commit refs/notes/foobar
-mark :10
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-notes (:10)
-COMMIT
-
-N inline :3
-data <<EOF
-$note1b_data
-EOF
-
-commit refs/notes/foobar2
-mark :11
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-notes (:11)
-COMMIT
-
-N inline :3
-data <<EOF
-$note1c_data
-EOF
-
-commit refs/notes/foobar
-mark :12
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-notes (:12)
-COMMIT
-
-deleteall
-N inline :5
-data <<EOF
-$note2b_data
-EOF
-
-INPUT_END
+ INPUT_END
-test_expect_success 'Q: commit notes' '
git fast-import <input &&
git whatchanged notes-test
'
@@ -1883,246 +1897,246 @@ test_expect_success 'Q: verify pack' '
verify_packs
'
-commit1=$(git rev-parse notes-test~2)
-commit2=$(git rev-parse notes-test^)
-commit3=$(git rev-parse notes-test)
+test_expect_success 'Q: verify first commit' '
+ commit1=$(git rev-parse notes-test~2) &&
+ commit2=$(git rev-parse notes-test^) &&
+ commit3=$(git rev-parse notes-test) &&
-cat >expect <<-EOF &&
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ cat >expect <<-EOF &&
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-first (:3)
-EOF
-test_expect_success 'Q: verify first commit' '
+ first (:3)
+ EOF
git cat-file commit notes-test~2 | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-parent $commit1
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-second (:5)
-EOF
test_expect_success 'Q: verify second commit' '
+ cat >expect <<-EOF &&
+ parent $commit1
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ second (:5)
+ EOF
git cat-file commit notes-test^ | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-parent $commit2
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-third (:6)
-EOF
test_expect_success 'Q: verify third commit' '
+ cat >expect <<-EOF &&
+ parent $commit2
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ third (:6)
+ EOF
git cat-file commit notes-test | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-notes (:9)
-EOF
test_expect_success 'Q: verify first notes commit' '
+ cat >expect <<-EOF &&
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ notes (:9)
+ EOF
git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect.unsorted <<-EOF &&
-100644 blob $commit1
-100644 blob $commit2
-100644 blob $commit3
-EOF
-cat expect.unsorted | sort >expect
test_expect_success 'Q: verify first notes tree' '
+ cat >expect.unsorted <<-EOF &&
+ 100644 blob $commit1
+ 100644 blob $commit2
+ 100644 blob $commit3
+ EOF
+ cat expect.unsorted | sort >expect &&
git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual
'
-echo "$note1_data" >expect
test_expect_success 'Q: verify first note for first commit' '
+ echo "$note1_data" >expect &&
git cat-file blob refs/notes/foobar~2:$commit1 >actual &&
test_cmp expect actual
'
-echo "$note2_data" >expect
test_expect_success 'Q: verify first note for second commit' '
+ echo "$note2_data" >expect &&
git cat-file blob refs/notes/foobar~2:$commit2 >actual &&
test_cmp expect actual
'
-echo "$note3_data" >expect
test_expect_success 'Q: verify first note for third commit' '
+ echo "$note3_data" >expect &&
git cat-file blob refs/notes/foobar~2:$commit3 >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-parent `git rev-parse --verify refs/notes/foobar~2`
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-notes (:10)
-EOF
test_expect_success 'Q: verify second notes commit' '
+ cat >expect <<-EOF &&
+ parent `git rev-parse --verify refs/notes/foobar~2`
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ notes (:10)
+ EOF
git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect.unsorted <<-EOF &&
-100644 blob $commit1
-100644 blob $commit2
-100644 blob $commit3
-EOF
-cat expect.unsorted | sort >expect
test_expect_success 'Q: verify second notes tree' '
+ cat >expect.unsorted <<-EOF &&
+ 100644 blob $commit1
+ 100644 blob $commit2
+ 100644 blob $commit3
+ EOF
+ cat expect.unsorted | sort >expect &&
git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual
'
-echo "$note1b_data" >expect
test_expect_success 'Q: verify second note for first commit' '
+ echo "$note1b_data" >expect &&
git cat-file blob refs/notes/foobar^:$commit1 >actual &&
test_cmp expect actual
'
-echo "$note2_data" >expect
test_expect_success 'Q: verify first note for second commit' '
+ echo "$note2_data" >expect &&
git cat-file blob refs/notes/foobar^:$commit2 >actual &&
test_cmp expect actual
'
-echo "$note3_data" >expect
test_expect_success 'Q: verify first note for third commit' '
+ echo "$note3_data" >expect &&
git cat-file blob refs/notes/foobar^:$commit3 >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-notes (:11)
-EOF
test_expect_success 'Q: verify third notes commit' '
+ cat >expect <<-EOF &&
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ notes (:11)
+ EOF
git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect.unsorted <<-EOF &&
-100644 blob $commit1
-EOF
-cat expect.unsorted | sort >expect
test_expect_success 'Q: verify third notes tree' '
+ cat >expect.unsorted <<-EOF &&
+ 100644 blob $commit1
+ EOF
+ cat expect.unsorted | sort >expect &&
git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual
'
-echo "$note1c_data" >expect
test_expect_success 'Q: verify third note for first commit' '
+ echo "$note1c_data" >expect &&
git cat-file blob refs/notes/foobar2:$commit1 >actual &&
test_cmp expect actual
'
-cat >expect <<-EOF &&
-parent `git rev-parse --verify refs/notes/foobar^`
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-
-notes (:12)
-EOF
test_expect_success 'Q: verify fourth notes commit' '
+ cat >expect <<-EOF &&
+ parent `git rev-parse --verify refs/notes/foobar^`
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+
+ notes (:12)
+ EOF
git cat-file commit refs/notes/foobar | sed 1d >actual &&
test_cmp expect actual
'
-cat >expect.unsorted <<-EOF &&
-100644 blob $commit2
-EOF
-cat expect.unsorted | sort >expect
test_expect_success 'Q: verify fourth notes tree' '
+ cat >expect.unsorted <<-EOF &&
+ 100644 blob $commit2
+ EOF
+ cat expect.unsorted | sort >expect &&
git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual
'
-echo "$note2b_data" >expect
test_expect_success 'Q: verify second note for second commit' '
+ echo "$note2b_data" >expect &&
git cat-file blob refs/notes/foobar:$commit2 >actual &&
test_cmp expect actual
'
-cat >input <<-EOF &&
-reset refs/heads/Q0
+test_expect_success 'Q: deny note on empty branch' '
+ cat >input <<-EOF &&
+ reset refs/heads/Q0
-commit refs/heads/note-Q0
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-Note for an empty branch.
-COMMIT
+ commit refs/heads/note-Q0
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ Note for an empty branch.
+ COMMIT
-N inline refs/heads/Q0
-data <<NOTE
-some note
-NOTE
-EOF
-test_expect_success 'Q: deny note on empty branch' '
+ N inline refs/heads/Q0
+ data <<NOTE
+ some note
+ NOTE
+ EOF
test_must_fail git fast-import <input
'
###
### series R (feature and option)
###
-cat >input <<-EOF &&
-feature no-such-feature-exists
-EOF
-
test_expect_success 'R: abort on unsupported feature' '
+ cat >input <<-EOF &&
+ feature no-such-feature-exists
+ EOF
+
test_must_fail git fast-import <input
'
-cat >input <<-EOF &&
-feature date-format=now
-EOF
-
test_expect_success 'R: supported feature is accepted' '
+ cat >input <<-EOF &&
+ feature date-format=now
+ EOF
+
git fast-import <input
'
-cat >input <<-EOF &&
-blob
-data 3
-hi
-feature date-format=now
-EOF
-
test_expect_success 'R: abort on receiving feature after data command' '
+ cat >input <<-EOF &&
+ blob
+ data 3
+ hi
+ feature date-format=now
+ EOF
+
test_must_fail git fast-import <input
'
-cat >input <<-EOF &&
-feature import-marks=git.marks
-feature import-marks=git2.marks
-EOF
-
test_expect_success 'R: only one import-marks feature allowed per stream' '
+ cat >input <<-EOF &&
+ feature import-marks=git.marks
+ feature import-marks=git2.marks
+ EOF
+
test_must_fail git fast-import <input
'
-cat >input <<-EOF &&
-feature export-marks=git.marks
-blob
-mark :1
-data 3
-hi
+test_expect_success 'R: export-marks feature results in a marks file being created' '
+ cat >input <<-EOF &&
+ feature export-marks=git.marks
+ blob
+ mark :1
+ data 3
+ hi
-EOF
+ EOF
-test_expect_success 'R: export-marks feature results in a marks file being created' '
cat input | git fast-import &&
grep :1 git.marks
'
@@ -2234,60 +2248,60 @@ test_expect_success 'R: feature import-marks-if-exists' '
test_cmp expect io.marks
'
-cat >input <<-EOF &&
-feature import-marks=marks.out
-feature export-marks=marks.new
-EOF
-
test_expect_success 'R: import to output marks works without any content' '
+ cat >input <<-EOF &&
+ feature import-marks=marks.out
+ feature export-marks=marks.new
+ EOF
+
cat input | git fast-import &&
test_cmp marks.out marks.new
'
-cat >input <<-EOF &&
-feature import-marks=nonexistent.marks
-feature export-marks=marks.new
-EOF
-
test_expect_success 'R: import marks prefers commandline marks file over the stream' '
+ cat >input <<-EOF &&
+ feature import-marks=nonexistent.marks
+ feature export-marks=marks.new
+ EOF
+
cat input | git fast-import --import-marks=marks.out &&
test_cmp marks.out marks.new
'
-cat >input <<-EOF &&
-feature import-marks=nonexistent.marks
-feature export-marks=combined.marks
-EOF
-
test_expect_success 'R: multiple --import-marks= should be honoured' '
+ cat >input <<-EOF &&
+ feature import-marks=nonexistent.marks
+ feature export-marks=combined.marks
+ EOF
+
head -n2 marks.out > one.marks &&
tail -n +3 marks.out > two.marks &&
git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
test_cmp marks.out combined.marks
'
-cat >input <<-EOF &&
-feature relative-marks
-feature import-marks=relative.in
-feature export-marks=relative.out
-EOF
-
test_expect_success 'R: feature relative-marks should be honoured' '
+ cat >input <<-EOF &&
+ feature relative-marks
+ feature import-marks=relative.in
+ feature export-marks=relative.out
+ EOF
+
mkdir -p .git/info/fast-import/ &&
cp marks.new .git/info/fast-import/relative.in &&
git fast-import <input &&
test_cmp marks.new .git/info/fast-import/relative.out
'
-cat >input <<-EOF &&
-feature relative-marks
-feature import-marks=relative.in
-feature no-relative-marks
-feature export-marks=non-relative.out
-EOF
-
test_expect_success 'R: feature no-relative-marks should be honoured' '
+ cat >input <<-EOF &&
+ feature relative-marks
+ feature import-marks=relative.in
+ feature no-relative-marks
+ feature export-marks=non-relative.out
+ EOF
+
git fast-import <input &&
test_cmp marks.new non-relative.out
'
@@ -2549,15 +2563,15 @@ test_expect_success PIPE 'R: print staged blob within commit' '
test_cmp expect actual
'
-cat >input <<-EOF &&
-option git quiet
-blob
-data 3
-hi
+test_expect_success 'R: quiet option results in no stats being output' '
+ cat >input <<-EOF &&
+ option git quiet
+ blob
+ data 3
+ hi
-EOF
+ EOF
-test_expect_success 'R: quiet option results in no stats being output' '
cat input | git fast-import 2> output &&
test_must_be_empty output
'
@@ -2604,11 +2618,11 @@ test_expect_success 'R: terminating "done" within commit' '
test_cmp expect actual
'
-cat >input <<-EOF &&
-option git non-existing-option
-EOF
-
test_expect_success 'R: die on unknown option' '
+ cat >input <<-EOF &&
+ option git non-existing-option
+ EOF
+
test_must_fail git fast-import <input
'
@@ -2624,38 +2638,38 @@ test_expect_success 'R: die on invalid option argument' '
test_must_fail git fast-import --depth="5 elephants" </dev/null
'
-cat >input <<-EOF &&
-option non-existing-vcs non-existing-option
-EOF
-
test_expect_success 'R: ignore non-git options' '
+ cat >input <<-EOF &&
+ option non-existing-vcs non-existing-option
+ EOF
+
git fast-import <input
'
##
## R: very large blobs
##
-blobsize=$((2*1024*1024 + 53))
-test-genrandom bar $blobsize >expect
-cat >input <<-INPUT_END &&
-commit refs/heads/big-file
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-R - big file
-COMMIT
-
-M 644 inline big1
-data $blobsize
-INPUT_END
-cat expect >>input
-cat >>input <<-INPUT_END &&
-M 644 inline big2
-data $blobsize
-INPUT_END
-cat expect >>input
-echo >>input
-
test_expect_success 'R: blob bigger than threshold' '
+ blobsize=$((2*1024*1024 + 53)) &&
+ test-genrandom bar $blobsize >expect &&
+ cat >input <<-INPUT_END &&
+ commit refs/heads/big-file
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ R - big file
+ COMMIT
+
+ M 644 inline big1
+ data $blobsize
+ INPUT_END
+ cat expect >>input &&
+ cat >>input <<-INPUT_END &&
+ M 644 inline big2
+ data $blobsize
+ INPUT_END
+ cat expect >>input &&
+ echo >>input &&
+
test_create_repo R &&
git --git-dir=R/.git fast-import --big-file-threshold=1 <input
'
@@ -2711,46 +2725,46 @@ test_expect_success 'R: blob appears only once' '
#
# Invalid dataref ..
#
-test_tick
-
-cat >input <<-INPUT_END &&
-commit refs/heads/S
-mark :301
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-commit 1
-COMMIT
-M 100644 inline hello.c
-data <<BLOB
-blob 1
-BLOB
-
-commit refs/heads/S
-mark :302
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-commit 2
-COMMIT
-from :301
-M 100644 inline hello.c
-data <<BLOB
-blob 2
-BLOB
-
-blob
-mark :403
-data <<BLOB
-blob 3
-BLOB
-
-blob
-mark :202
-data <<BLOB
-note 2
-BLOB
-INPUT_END
-
test_expect_success 'S: initialize for S tests' '
+ test_tick &&
+
+ cat >input <<-INPUT_END &&
+ commit refs/heads/S
+ mark :301
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ commit 1
+ COMMIT
+ M 100644 inline hello.c
+ data <<BLOB
+ blob 1
+ BLOB
+
+ commit refs/heads/S
+ mark :302
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ commit 2
+ COMMIT
+ from :301
+ M 100644 inline hello.c
+ data <<BLOB
+ blob 2
+ BLOB
+
+ blob
+ mark :403
+ data <<BLOB
+ blob 3
+ BLOB
+
+ blob
+ mark :202
+ data <<BLOB
+ note 2
+ BLOB
+ INPUT_END
+
git fast-import --export-marks=marks <input
'
@@ -3002,103 +3016,103 @@ test_expect_success 'T: empty reset doesnt delete branch' '
### series U (filedelete)
###
-cat >input <<-INPUT_END &&
-commit refs/heads/U
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-test setup
-COMMIT
-M 100644 inline hello.c
-data <<BLOB
-blob 1
-BLOB
-M 100644 inline good/night.txt
-data <<BLOB
-sleep well
-BLOB
-M 100644 inline good/bye.txt
-data <<BLOB
-au revoir
-BLOB
-
-INPUT_END
-
test_expect_success 'U: initialize for U tests' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/U
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ test setup
+ COMMIT
+ M 100644 inline hello.c
+ data <<BLOB
+ blob 1
+ BLOB
+ M 100644 inline good/night.txt
+ data <<BLOB
+ sleep well
+ BLOB
+ M 100644 inline good/bye.txt
+ data <<BLOB
+ au revoir
+ BLOB
+
+ INPUT_END
+
git fast-import <input
'
-cat >input <<-INPUT_END &&
-commit refs/heads/U
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-delete good/night.txt
-COMMIT
-from refs/heads/U^0
-D good/night.txt
+test_expect_success 'U: filedelete file succeeds' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/U
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ delete good/night.txt
+ COMMIT
+ from refs/heads/U^0
+ D good/night.txt
-INPUT_END
+ INPUT_END
-test_expect_success 'U: filedelete file succeeds' '
git fast-import <input
'
-cat >expect <<-EOF &&
-:100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
-EOF
+test_expect_success 'U: validate file delete result' '
+ cat >expect <<-EOF &&
+ :100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
+ EOF
-git diff-tree -M -r U^1 U >actual
+ git diff-tree -M -r U^1 U >actual &&
-test_expect_success 'U: validate file delete result' '
compare_diff_raw expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/U
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-delete good dir
-COMMIT
-from refs/heads/U^0
-D good
+test_expect_success 'U: filedelete directory succeeds' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/U
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ delete good dir
+ COMMIT
+ from refs/heads/U^0
+ D good
-INPUT_END
+ INPUT_END
-test_expect_success 'U: filedelete directory succeeds' '
git fast-import <input
'
-cat >expect <<-EOF &&
-:100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
-EOF
+test_expect_success 'U: validate directory delete result' '
+ cat >expect <<-EOF &&
+ :100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
+ EOF
-git diff-tree -M -r U^1 U >actual
+ git diff-tree -M -r U^1 U >actual &&
-test_expect_success 'U: validate directory delete result' '
compare_diff_raw expect actual
'
-cat >input <<-INPUT_END &&
-commit refs/heads/U
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-must succeed
-COMMIT
-from refs/heads/U^0
-D ""
+test_expect_success 'U: filedelete root succeeds' '
+ cat >input <<-INPUT_END &&
+ commit refs/heads/U
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ must succeed
+ COMMIT
+ from refs/heads/U^0
+ D ""
-INPUT_END
+ INPUT_END
-test_expect_success 'U: filedelete root succeeds' '
git fast-import <input
'
-cat >expect <<-EOF &&
-:100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
-EOF
+test_expect_success 'U: validate root delete result' '
+ cat >expect <<-EOF &&
+ :100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
+ EOF
-git diff-tree -M -r U^1 U >actual
+ git diff-tree -M -r U^1 U >actual &&
-test_expect_success 'U: validate root delete result' '
compare_diff_raw expect actual
'
--
2.6.2.337.ga235d84
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/7] Modernize t9300-fast-import
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
` (6 preceding siblings ...)
2015-11-19 19:09 ` [PATCH 7/7] modernize t9300: move test preparations into test_expect_success Johannes Sixt
@ 2015-11-20 3:54 ` Eric Sunshine
2015-11-20 11:22 ` Jeff King
7 siblings, 1 reply; 10+ messages in thread
From: Eric Sunshine @ 2015-11-20 3:54 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Git List
On Thu, Nov 19, 2015 at 2:09 PM, Johannes Sixt <j6t@kdbg.org> wrote:
> Some time ago, I had to dig into t9300-fast-import and found it quite
> unhelpful that it does not follow our modern best-practices. This series
> brings it up-to-date. I thought I submit it now while it is quiet in
> the area.
>
> The larger patches are best viewed using -w -color-words because the
> regular patch text is ... overwhelming.
For what it's worth, I read through the series (with care, I hope) and
didn't find anything amiss.
> Improving shell coding style is outside the scope of this series. I mean
> fixing eyesores such as 'cat >foo <<EOF && cat foo | sort > bar', or minor
> things such as quoting <<\EOF when the here-doc does not require
> substitutions.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/7] Modernize t9300-fast-import
2015-11-20 3:54 ` [PATCH 0/7] Modernize t9300-fast-import Eric Sunshine
@ 2015-11-20 11:22 ` Jeff King
0 siblings, 0 replies; 10+ messages in thread
From: Jeff King @ 2015-11-20 11:22 UTC (permalink / raw)
To: Eric Sunshine; +Cc: Johannes Sixt, Git List
On Thu, Nov 19, 2015 at 10:54:11PM -0500, Eric Sunshine wrote:
> On Thu, Nov 19, 2015 at 2:09 PM, Johannes Sixt <j6t@kdbg.org> wrote:
> > Some time ago, I had to dig into t9300-fast-import and found it quite
> > unhelpful that it does not follow our modern best-practices. This series
> > brings it up-to-date. I thought I submit it now while it is quiet in
> > the area.
> >
> > The larger patches are best viewed using -w -color-words because the
> > regular patch text is ... overwhelming.
>
> For what it's worth, I read through the series (with care, I hope) and
> didn't find anything amiss.
Thanks, both. I gave it a quick read and didn't see anything wrong. The
end result is certainly nicer to read. :)
-Peff
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-11-20 11:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 19:09 [PATCH 0/7] Modernize t9300-fast-import Johannes Sixt
2015-11-19 19:09 ` [PATCH 1/7] modernize t9300: single-quote placement and indentation Johannes Sixt
2015-11-19 19:09 ` [PATCH 2/7] modernize t9300: use test_must_fail Johannes Sixt
2015-11-19 19:09 ` [PATCH 3/7] modernize t9300: use test_must_be_empty Johannes Sixt
2015-11-19 19:09 ` [PATCH 4/7] modernize t9300: wrap lines after && Johannes Sixt
2015-11-19 19:09 ` [PATCH 5/7] modernize t9300: use test_when_finished for clean-up Johannes Sixt
2015-11-19 19:09 ` [PATCH 6/7] modernize t9300: mark here-doc words to ignore tab indentation Johannes Sixt
2015-11-19 19:09 ` [PATCH 7/7] modernize t9300: move test preparations into test_expect_success Johannes Sixt
2015-11-20 3:54 ` [PATCH 0/7] Modernize t9300-fast-import Eric Sunshine
2015-11-20 11:22 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).