path: root/t/
diff options
authorStefan Beller <>2017-09-12 17:30:27 (GMT)
committerJunio C Hamano <>2017-09-14 06:05:51 (GMT)
commit3c96aa97232367a24eef8b3b387f5ddae5b0c10f (patch)
tree63b2cfeb38174fdf5e607561c2a7b8feb9671550 /t/
parent607bd8315c6886eb61561bbba394616bc6fdf031 (diff)
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 <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 10 insertions, 0 deletions
diff --git a/t/ b/t/
index 0f84a53..39cb2c1 100755
--- a/t/
+++ b/t/
@@ -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 &&