t4041 (diff-submodule-option): modernize style

- Enclose tests in single quotes as opposed to double quotes.  This is
  the prevalent style in other tests.
- Remove the unused variable $head4_full.
- Indent the expected output so that it lines up with the rest of the
  test text.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ramkumar Ramachandra 2012-11-30 17:07:36 +05:30 коммит произвёл Junio C Hamano
Родитель 2934975f2d
Коммит a1549f9b85
1 изменённых файлов: 228 добавлений и 229 удалений

Просмотреть файл

@ -35,16 +35,16 @@ add_file . foo >/dev/null
head1=$(add_file sm1 foo1 foo2)
fullhead1=$(cd sm1; git rev-parse --verify HEAD)
test_expect_success 'added submodule' "
test_expect_success 'added submodule' '
git add sm1 &&
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 0000000...$head1 (new submodule)
EOF
test_cmp expected actual
"
'
test_expect_success 'added submodule, set diff.submodule' "
test_expect_success 'added submodule, set diff.submodule' '
git config diff.submodule log &&
git add sm1 &&
git diff --cached >actual &&
@ -53,9 +53,9 @@ Submodule sm1 0000000...$head1 (new submodule)
EOF
git config --unset diff.submodule &&
test_cmp expected actual
"
'
test_expect_success '--submodule=short overrides diff.submodule' "
test_expect_success '--submodule=short overrides diff.submodule' '
test_config diff.submodule log &&
git add sm1 &&
git diff --submodule=short --cached >actual &&
@ -69,7 +69,7 @@ index 0000000..$head1
+Subproject commit $fullhead1
EOF
test_cmp expected actual
"
'
test_expect_success 'diff.submodule does not affect plumbing' '
test_config diff.submodule log &&
@ -89,35 +89,35 @@ test_expect_success 'diff.submodule does not affect plumbing' '
commit_file sm1 &&
head2=$(add_file sm1 foo3)
test_expect_success 'modified submodule(forward)' "
test_expect_success 'modified submodule(forward)' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head1..$head2:
> Add foo3
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule(forward)' "
test_expect_success 'modified submodule(forward)' '
git diff --submodule=log >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head1..$head2:
> Add foo3
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule(forward) --submodule' "
test_expect_success 'modified submodule(forward) --submodule' '
git diff --submodule >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head1..$head2:
> Add foo3
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule(forward) --submodule=short' "
fullhead2=$(cd sm1; git rev-parse --verify HEAD)
test_expect_success 'modified submodule(forward) --submodule=short' '
git diff --submodule=short >actual &&
cat >expected <<-EOF &&
diff --git a/sm1 b/sm1
@ -129,7 +129,7 @@ index $head1..$head2 160000
+Subproject commit $fullhead2
EOF
test_cmp expected actual
"
'
commit_file sm1 &&
head3=$(
@ -138,7 +138,7 @@ head3=$(
git rev-parse --short --verify HEAD
)
test_expect_success 'modified submodule(backward)' "
test_expect_success 'modified submodule(backward)' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head2..$head3 (rewind):
@ -146,11 +146,10 @@ Submodule sm1 $head2..$head3 (rewind):
< Add foo2
EOF
test_cmp expected actual
"
'
head4=$(add_file sm1 foo4 foo5) &&
head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)
test_expect_success 'modified submodule(backward and forward)' "
head4=$(add_file sm1 foo4 foo5)
test_expect_success 'modified submodule(backward and forward)' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head2...$head4:
@ -160,7 +159,7 @@ Submodule sm1 $head2...$head4:
< Add foo2
EOF
test_cmp expected actual
"
'
commit_file sm1 &&
mv sm1 sm1-bak &&
@ -170,7 +169,7 @@ git add sm1 &&
rm -f sm1 &&
mv sm1-bak sm1
test_expect_success 'typechanged submodule(submodule->blob), --cached' "
test_expect_success 'typechanged submodule(submodule->blob), --cached' '
git diff --submodule=log --cached >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head4...0000000 (submodule deleted)
@ -183,9 +182,9 @@ index 0000000..$head5
+sm1
EOF
test_cmp expected actual
"
'
test_expect_success 'typechanged submodule(submodule->blob)' "
test_expect_success 'typechanged submodule(submodule->blob)' '
git diff --submodule=log >actual &&
cat >expected <<-EOF &&
diff --git a/sm1 b/sm1
@ -198,11 +197,11 @@ index $head5..0000000
Submodule sm1 0000000...$head4 (new submodule)
EOF
test_cmp expected actual
"
'
rm -rf sm1 &&
git checkout-index sm1
test_expect_success 'typechanged submodule(submodule->blob)' "
test_expect_success 'typechanged submodule(submodule->blob)' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head4...0000000 (submodule deleted)
@ -215,22 +214,22 @@ index 0000000..$head5
+sm1
EOF
test_cmp expected actual
"
'
rm -f sm1 &&
test_create_repo sm1 &&
head6=$(add_file sm1 foo6 foo7)
test_expect_success 'nonexistent commit' "
fullhead6=$(cd sm1; git rev-parse --verify HEAD)
test_expect_success 'nonexistent commit' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head4...$head6 (commits not present)
EOF
test_cmp expected actual
"
'
commit_file
test_expect_success 'typechanged submodule(blob->submodule)' "
test_expect_success 'typechanged submodule(blob->submodule)' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
diff --git a/sm1 b/sm1
@ -243,41 +242,41 @@ index $head5..0000000
Submodule sm1 0000000...$head6 (new submodule)
EOF
test_cmp expected actual
"
'
commit_file sm1 &&
test_expect_success 'submodule is up to date' "
test_expect_success 'submodule is up to date' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
EOF
test_cmp expected actual
"
'
test_expect_success 'submodule contains untracked content' "
test_expect_success 'submodule contains untracked content' '
echo new > sm1/new-file &&
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 contains untracked content
EOF
test_cmp expected actual
"
'
test_expect_success 'submodule contains untracked content (untracked ignored)' "
test_expect_success 'submodule contains untracked content (untracked ignored)' '
git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
! test -s actual
"
'
test_expect_success 'submodule contains untracked content (dirty ignored)' "
test_expect_success 'submodule contains untracked content (dirty ignored)' '
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
! test -s actual
"
'
test_expect_success 'submodule contains untracked content (all ignored)' "
test_expect_success 'submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
! test -s actual
"
'
test_expect_success 'submodule contains untracked and modifed content' "
test_expect_success 'submodule contains untracked and modifed content' '
echo new > sm1/foo6 &&
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
@ -285,50 +284,50 @@ Submodule sm1 contains untracked content
Submodule sm1 contains modified content
EOF
test_cmp expected actual
"
'
test_expect_success 'submodule contains untracked and modifed content (untracked ignored)' "
test_expect_success 'submodule contains untracked and modifed content (untracked ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 contains modified content
EOF
test_cmp expected actual
"
'
test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' "
test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
! test -s actual
"
'
test_expect_success 'submodule contains untracked and modifed content (all ignored)' "
test_expect_success 'submodule contains untracked and modifed content (all ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
! test -s actual
"
'
test_expect_success 'submodule contains modifed content' "
test_expect_success 'submodule contains modifed content' '
rm -f sm1/new-file &&
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 contains modified content
EOF
test_cmp expected actual
"
'
(cd sm1; git commit -mchange foo6 >/dev/null) &&
test_expect_success 'submodule is modified' "
head8=$(cd sm1; git rev-parse --short --verify HEAD) &&
test_expect_success 'submodule is modified' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule contains untracked content' "
test_expect_success 'modified submodule contains untracked content' '
echo new > sm1/new-file &&
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
@ -337,32 +336,32 @@ Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule contains untracked content (untracked ignored)' "
test_expect_success 'modified submodule contains untracked content (untracked ignored)' '
git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule contains untracked content (dirty ignored)' "
test_expect_success 'modified submodule contains untracked content (dirty ignored)' '
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule contains untracked content (all ignored)' "
test_expect_success 'modified submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
! test -s actual
"
'
test_expect_success 'modified submodule contains untracked and modifed content' "
test_expect_success 'modified submodule contains untracked and modifed content' '
echo modification >> sm1/foo6 &&
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
@ -372,9 +371,9 @@ Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule contains untracked and modifed content (untracked ignored)' "
test_expect_success 'modified submodule contains untracked and modifed content (untracked ignored)' '
echo modification >> sm1/foo6 &&
git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
@ -383,9 +382,9 @@ Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule contains untracked and modifed content (dirty ignored)' "
test_expect_success 'modified submodule contains untracked and modifed content (dirty ignored)' '
echo modification >> sm1/foo6 &&
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
@ -393,15 +392,15 @@ Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' "
test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' '
echo modification >> sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
! test -s actual
"
'
test_expect_success 'modified submodule contains modifed content' "
test_expect_success 'modified submodule contains modifed content' '
rm -f sm1/new-file &&
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
@ -410,60 +409,60 @@ Submodule sm1 $head6..$head8:
> change
EOF
test_cmp expected actual
"
'
rm -rf sm1
test_expect_success 'deleted submodule' "
test_expect_success 'deleted submodule' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head6...0000000 (submodule deleted)
EOF
test_cmp expected actual
"
'
test_create_repo sm2 &&
head7=$(add_file sm2 foo8 foo9) &&
git add sm2
test_expect_success 'multiple submodules' "
test_expect_success 'multiple submodules' '
git diff-index -p --submodule=log HEAD >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head6...0000000 (submodule deleted)
Submodule sm2 0000000...$head7 (new submodule)
EOF
test_cmp expected actual
"
'
test_expect_success 'path filter' "
test_expect_success 'path filter' '
git diff-index -p --submodule=log HEAD sm2 >actual &&
cat >expected <<-EOF &&
Submodule sm2 0000000...$head7 (new submodule)
EOF
test_cmp expected actual
"
'
commit_file sm2
test_expect_success 'given commit' "
test_expect_success 'given commit' '
git diff-index -p --submodule=log HEAD^ >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head6...0000000 (submodule deleted)
Submodule sm2 0000000...$head7 (new submodule)
EOF
test_cmp expected actual
"
'
test_expect_success 'given commit --submodule' "
test_expect_success 'given commit --submodule' '
git diff-index -p --submodule HEAD^ >actual &&
cat >expected <<-EOF &&
Submodule sm1 $head6...0000000 (submodule deleted)
Submodule sm2 0000000...$head7 (new submodule)
EOF
test_cmp expected actual
"
'
fullhead7=$(cd sm2; git rev-parse --verify HEAD)
test_expect_success 'given commit --submodule=short' "
test_expect_success 'given commit --submodule=short' '
git diff-index -p --submodule=short HEAD^ >actual &&
cat >expected <<-EOF &&
diff --git a/sm1 b/sm1
@ -482,7 +481,7 @@ index 0000000..$head7
+Subproject commit $fullhead7
EOF
test_cmp expected actual
"
'
test_expect_success 'setup .git file for sm2' '
(cd sm2 &&