3 test_description
='difference in submodules'
6 .
"$TEST_DIRECTORY"/diff-lib.sh
8 _z40
=0000000000000000000000000000000000000000
9 test_expect_success setup
'
11 test_create_repo sub &&
16 git commit -m submodule
22 git commit -m superproject &&
26 echo goodbye >world &&
28 git commit -m "submodule #2"
35 echo ":160000 160000 $3 $_z40 M sub" >expect
38 test_expect_success
'git diff --raw HEAD' '
39 git diff --raw --abbrev=40 HEAD >actual &&
40 test_cmp expect actual
43 test_expect_success
'git diff-index --raw HEAD' '
44 git diff-index --raw HEAD >actual.index &&
45 test_cmp expect actual.index
48 test_expect_success
'git diff-files --raw' '
49 git diff-files --raw >actual.files &&
50 test_cmp expect actual.files
53 test_expect_success
'git diff (empty submodule dir)' '
55 rm -rf sub/* sub/.git &&
56 git diff > actual.empty &&
57 test_cmp empty actual.empty
60 test_expect_success
'conflicted submodule setup' '
63 c=fffffffffffffffffffffffffffffffffffffff
65 echo "000000 $_z40 0 sub"
66 echo "160000 1$c 1 sub"
67 echo "160000 2$c 2 sub"
68 echo "160000 3$c 3 sub"
69 ) | git update-index --index-info &&
70 echo >expect.nosub '\''diff --cc sub
71 index 2ffffff,3ffffff..0000000
74 @@@ -1,1 -1,1 +1,1 @@@
75 - Subproject commit 2fffffffffffffffffffffffffffffffffffffff
76 -Subproject commit 3fffffffffffffffffffffffffffffffffffffff
77 ++Subproject commit 0000000000000000000000000000000000000000'\'' &&
79 hh=$(git rev-parse HEAD) &&
80 sed -e "s/$_z40/$hh/" expect.nosub >expect.withsub
84 test_expect_success
'combined (empty submodule)' '
85 rm -fr sub && mkdir sub &&
87 test_cmp expect.nosub actual
90 test_expect_success
'combined (with submodule)' '
92 git clone --no-checkout . sub &&
94 test_cmp expect.withsub actual