summaryrefslogtreecommitdiff
path: root/t/t7406-submodule-update.sh
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-07-29 00:44:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-01 21:40:56 (GMT)
commitd4470c5a46f0fa965b1916308025d031545005fe (patch)
tree0f04ca143837ec24b95757c860bfcfd24721bc08 /t/t7406-submodule-update.sh
parentf8f7adce9fc50a11a764d57815602dcb818d1816 (diff)
downloadgit-d4470c5a46f0fa965b1916308025d031545005fe.zip
git-d4470c5a46f0fa965b1916308025d031545005fe.tar.gz
git-d4470c5a46f0fa965b1916308025d031545005fe.tar.bz2
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>
Diffstat (limited to 't/t7406-submodule-update.sh')
-rwxr-xr-xt/t7406-submodule-update.sh19
1 files changed, 11 insertions, 8 deletions
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 88e9750..8fc3a25 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -841,16 +841,19 @@ test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd'
'
test_expect_success 'submodule update clone shallow submodule' '
+ test_when_finished "rm -rf super3" &&
+ first=$(git -C cloned submodule status submodule |cut -c2-41) &&
+ second=$(git -C submodule rev-parse HEAD) &&
+ commit_count=$(git -C submodule rev-list $first^..$second | wc -l) &&
git clone cloned super3 &&
pwd=$(pwd) &&
- (cd super3 &&
- sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
- mv -f .gitmodules.tmp .gitmodules &&
- git submodule update --init --depth=3
- (cd submodule &&
- test 1 = $(git log --oneline | wc -l)
- )
-)
+ (
+ cd super3 &&
+ sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
+ mv -f .gitmodules.tmp .gitmodules &&
+ git submodule update --init --depth=$commit_count &&
+ test 1 = $(git -C submodule log --oneline | wc -l)
+ )
'
test_expect_success 'submodule update --recursive drops module name before recursing' '