Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit d518635

Browse files
vangdfangdscho
authored andcommitted
Add a test demonstrating a problem with long submodule paths
Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 64d6324 commit d518635

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

t/t7410-submodule-long-path.sh

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2013 Doug Kelly
4+
#
5+
6+
test_description='Test submodules with a path near PATH_MAX
7+
8+
This test verifies that "git submodule" initialization, update and clones work, including with recursive submodules and paths approaching PATH_MAX (260 characters on Windows)
9+
'
10+
11+
TEST_NO_CREATE_REPO=1
12+
. ./test-lib.sh
13+
14+
longpath=""
15+
for (( i=0; i<4; i++ )); do
16+
longpath="0123456789abcdefghijklmnopqrstuvwxyz$longpath"
17+
done
18+
# Pick a substring maximum of 90 characters
19+
# This should be good, since we'll add on a lot for temp directories
20+
export longpath=${longpath:0:90}
21+
22+
test_expect_failure 'submodule with a long path' '
23+
git init --bare remote &&
24+
test_create_repo bundle1 &&
25+
(
26+
cd bundle1 &&
27+
test_commit "shoot" &&
28+
git rev-parse --verify HEAD >../expect
29+
) &&
30+
mkdir home &&
31+
(
32+
cd home &&
33+
git clone ../remote test &&
34+
cd test &&
35+
git submodule add ../bundle1 $longpath &&
36+
test_commit "sogood" &&
37+
(
38+
cd $longpath &&
39+
git rev-parse --verify HEAD >actual &&
40+
test_cmp ../../../expect actual
41+
) &&
42+
git push origin master
43+
) &&
44+
mkdir home2 &&
45+
(
46+
cd home2 &&
47+
git clone ../remote test &&
48+
cd test &&
49+
git checkout master &&
50+
git submodule update --init &&
51+
(
52+
cd $longpath &&
53+
git rev-parse --verify HEAD >actual &&
54+
test_cmp ../../../expect actual
55+
)
56+
)
57+
'
58+
59+
test_expect_failure 'recursive submodule with a long path' '
60+
git init --bare super &&
61+
test_create_repo child &&
62+
(
63+
cd child &&
64+
test_commit "shoot" &&
65+
git rev-parse --verify HEAD >../expect
66+
) &&
67+
test_create_repo parent &&
68+
(
69+
cd parent &&
70+
git submodule add ../child $longpath &&
71+
test_commit "aim"
72+
) &&
73+
mkdir home3 &&
74+
(
75+
cd home3 &&
76+
git clone ../super test &&
77+
cd test &&
78+
git submodule add ../parent foo &&
79+
git submodule update --init --recursive
80+
test_commit "sogood" &&
81+
(
82+
cd foo/$longpath &&
83+
git rev-parse --verify HEAD >actual &&
84+
test_cmp ../../../../expect actual
85+
) &&
86+
git push origin master
87+
) &&
88+
mkdir home4 &&
89+
(
90+
cd home4 &&
91+
git clone ../super test --recursive &&
92+
(
93+
cd test/foo/$longpath &&
94+
git rev-parse --verify HEAD >actual &&
95+
test_cmp ../../../../expect actual
96+
)
97+
)
98+
'
99+
unset longpath
100+
101+
test_done

0 commit comments

Comments
 (0)