diff options
author | Stefan Beller <sbeller@google.com> | 2017-09-12 10:30:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-14 15:05:51 +0900 |
commit | 3c96aa97232367a24eef8b3b387f5ddae5b0c10f (patch) | |
tree | 63b2cfeb38174fdf5e607561c2a7b8feb9671550 /t | |
parent | pack: make packed_git_mru global a value instead of a pointer (diff) | |
download | tgif-3c96aa97232367a24eef8b3b387f5ddae5b0c10f.tar.xz |
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')
-rwxr-xr-x | t/t5531-deep-submodule-push.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh index 0f84a53146..39cb2c1c34 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 && |