summaryrefslogtreecommitdiff
path: root/t/t5531-deep-submodule-push.sh
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-09-12 17:30:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-14 06:05:51 (GMT)
commit3c96aa97232367a24eef8b3b387f5ddae5b0c10f (patch)
tree63b2cfeb38174fdf5e607561c2a7b8feb9671550 /t/t5531-deep-submodule-push.sh
parent607bd8315c6886eb61561bbba394616bc6fdf031 (diff)
downloadgit-3c96aa97232367a24eef8b3b387f5ddae5b0c10f.zip
git-3c96aa97232367a24eef8b3b387f5ddae5b0c10f.tar.gz
git-3c96aa97232367a24eef8b3b387f5ddae5b0c10f.tar.bz2
push, fetch: error out for submodule entries not pointing to commits
The check_has_commit helper uses resolves a submodule entry to a commit, when validating its existence. As a side effect this means tolerates a submodule entry pointing to a tag, which is not a valid submodule entry that git commands would know how to cope with. Tighten the check to require an actual commit, not a tag pointing to a commit. Also improve the error handling when a submodule entry points to non-commit (e.g., a blob) to error out instead of warning and pretending the pointed to object doesn't exist. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5531-deep-submodule-push.sh')
-rwxr-xr-xt/t5531-deep-submodule-push.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 0f84a53..39cb2c1 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -298,6 +298,16 @@ test_expect_success 'push succeeds if submodule commit disabling recursion from
)
'
+test_expect_success 'submodule entry pointing at a tag is error' '
+ git -C work/gar/bage tag -a test1 -m "tag" &&
+ tag=$(git -C work/gar/bage rev-parse test1^{tag}) &&
+ git -C work update-index --cacheinfo 160000 "$tag" gar/bage &&
+ git -C work commit -m "bad commit" &&
+ test_when_finished "git -C work reset --hard HEAD^" &&
+ test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git master 2>err &&
+ test_i18ngrep "is a tag, not a commit" err
+'
+
test_expect_success 'push fails if recurse submodules option passed as yes' '
(
cd work/gar/bage &&