Browse Source

t1011 (sparse checkout): style nitpicks

Tweak the rest of the script to more closely follow the test
style guide.  Guarding setup commands with test_expect_success
makes it easy to see the scope in which some particular data is
used; removal of whitespace after >redirection operators is just
for consistency.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jonathan Nieder 15 years ago committed by Junio C Hamano
parent
commit
7f71a6ae18
  1. 42
      t/t1011-read-tree-sparse-checkout.sh

42
t/t1011-read-tree-sparse-checkout.sh

@ -1,14 +1,28 @@
#!/bin/sh #!/bin/sh


test_description='sparse checkout tests' test_description='sparse checkout tests

* (tag: removed, master) removed
| D sub/added
* (HEAD, tag: top) modified and added
| M init.t
| A sub/added
* (tag: init) init
A init.t
'


. ./test-lib.sh . ./test-lib.sh


cat >expected <<EOF test_expect_success 'setup' '
cat >expected <<-\EOF &&
100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0 init.t 100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0 init.t
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 sub/added 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 sub/added
EOF EOF
test_expect_success 'setup' ' cat >expected.swt <<-\EOF &&
H init.t
H sub/added
EOF

test_commit init && test_commit init &&
echo modified >>init.t && echo modified >>init.t &&
mkdir sub && mkdir sub &&
@ -24,10 +38,6 @@ test_expect_success 'setup' '
test_cmp expected result test_cmp expected result
' '


cat >expected.swt <<EOF
H init.t
H sub/added
EOF
test_expect_success 'read-tree without .git/info/sparse-checkout' ' test_expect_success 'read-tree without .git/info/sparse-checkout' '
git read-tree -m -u HEAD && git read-tree -m -u HEAD &&
git ls-files --stage >result && git ls-files --stage >result &&
@ -67,23 +77,20 @@ test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
test -f sub/added test -f sub/added
' '


cat >expected.swt <<EOF test_expect_success 'match directories with trailing slash' '
cat >expected.swt-noinit <<-\EOF &&
S init.t S init.t
H sub/added H sub/added
EOF EOF
test_expect_success 'match directories with trailing slash' '
echo sub/ > .git/info/sparse-checkout && echo sub/ > .git/info/sparse-checkout &&
git read-tree -m -u HEAD && git read-tree -m -u HEAD &&
git ls-files -t > result && git ls-files -t > result &&
test_cmp expected.swt result && test_cmp expected.swt-noinit result &&
test ! -f init.t && test ! -f init.t &&
test -f sub/added test -f sub/added
' '


cat >expected.swt <<EOF
H init.t
H sub/added
EOF
test_expect_failure 'match directories without trailing slash' ' test_expect_failure 'match directories without trailing slash' '
echo init.t >.git/info/sparse-checkout && echo init.t >.git/info/sparse-checkout &&
echo sub >>.git/info/sparse-checkout && echo sub >>.git/info/sparse-checkout &&
@ -94,15 +101,16 @@ test_expect_failure 'match directories without trailing slash' '
test -f sub/added test -f sub/added
' '


cat >expected.swt <<EOF test_expect_success 'checkout area changes' '
cat >expected.swt-nosub <<-\EOF &&
H init.t H init.t
S sub/added S sub/added
EOF EOF
test_expect_success 'checkout area changes' '
echo init.t >.git/info/sparse-checkout && echo init.t >.git/info/sparse-checkout &&
git read-tree -m -u HEAD && git read-tree -m -u HEAD &&
git ls-files -t >result && git ls-files -t >result &&
test_cmp expected.swt result && test_cmp expected.swt-nosub result &&
test -f init.t && test -f init.t &&
test ! -f sub/added test ! -f sub/added
' '

Loading…
Cancel
Save