t7406: future proof tests with hard coded depth
The prior hard coded depth was chosen to be exactly the length from the recorded gitlink to the tip of the remote, so if you add more commits to the remote before, this test will not test its intention any more. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Jul 28, 2016 at 17:44 UTC
d4470c5a46f0fa965b1916308025d031545005fe
1 file changed
+11
-8
t/t7406-submodule-update.sh
+11
-8
@@ -841,16 +841,19 @@ test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd'
841
'
842
843
test_expect_success 'submodule update clone shallow submodule' '
844
+ test_when_finished "rm -rf super3" &&
845
+ first=$(git -C cloned submodule status submodule |cut -c2-41) &&
846
+ second=$(git -C submodule rev-parse HEAD) &&
847
+ commit_count=$(git -C submodule rev-list $first^..$second | wc -l) &&
848
git clone cloned super3 &&
849
pwd=$(pwd) &&
846
- (cd super3 &&
847
- sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
848
- mv -f .gitmodules.tmp .gitmodules &&
849
- git submodule update --init --depth=3
850
- (cd submodule &&
851
- test 1 = $(git log --oneline | wc -l)
852
- )
853
-)
850
+ (
851
+ cd super3 &&
852
+ sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
853
+ mv -f .gitmodules.tmp .gitmodules &&
854
+ git submodule update --init --depth=$commit_count &&
855
+ test 1 = $(git -C submodule log --oneline | wc -l)
856
+ )
857
'
858
859
test_expect_success 'submodule update --recursive drops module name before recursing' '