aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-03-08 15:07:42 -0800
committerJunio C Hamano <gitster@pobox.com>2017-03-08 15:52:03 -0800
commitbf0231c66140be5194ac76a4a9f79e949c588293 (patch)
tree737d073963f47b249c5dcc4b4f2928da25313608 /t
parente0688e9b28f2c5ff711460ee8b62077be5df2360 (diff)
downloadgit-bf0231c66140be5194ac76a4a9f79e949c588293.tar.gz
git-bf0231c66140be5194ac76a4a9f79e949c588293.tar.xz
rev-parse: add --show-superproject-working-tree
In some situations it is useful to know if the given repository is a submodule of another repository. Add the flag --show-superproject-working-tree to git-rev-parse to make it easy to find out if there is a superproject. When no superproject exists, the output will be empty. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1500-rev-parse.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 9ed8b8ccb..03d3c7f6d 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -116,4 +116,18 @@ test_expect_success 'git-path inside sub-dir' '
test_cmp expect actual
'
+test_expect_success 'showing the superproject correctly' '
+ git rev-parse --show-superproject-working-tree >out &&
+ test_must_be_empty out &&
+
+ test_create_repo super &&
+ test_commit -C super test_commit &&
+ test_create_repo sub &&
+ test_commit -C sub test_commit &&
+ git -C super submodule add ../sub dir/sub &&
+ echo $(pwd)/super >expect &&
+ git -C super/dir/sub rev-parse --show-superproject-working-tree >out &&
+ test_cmp expect out
+'
+
test_done