diff options
author | Stefan Beller <sbeller@google.com> | 2017-03-08 15:07:42 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-08 15:52:03 -0800 |
commit | bf0231c66140be5194ac76a4a9f79e949c588293 (patch) | |
tree | 737d073963f47b249c5dcc4b4f2928da25313608 /builtin | |
parent | e0688e9b28f2c5ff711460ee8b62077be5df2360 (diff) | |
download | git-bf0231c66140be5194ac76a4a9f79e949c588293.tar.gz |
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 'builtin')
-rw-r--r-- | builtin/rev-parse.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index e08677e559..2549643267 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -12,6 +12,7 @@ #include "diff.h" #include "revision.h" #include "split-index.h" +#include "submodule.h" #define DO_REVS 1 #define DO_NOREV 2 @@ -779,6 +780,12 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) puts(work_tree); continue; } + if (!strcmp(arg, "--show-superproject-working-tree")) { + const char *superproject = get_superproject_working_tree(); + if (superproject) + puts(superproject); + continue; + } if (!strcmp(arg, "--show-prefix")) { if (prefix) puts(prefix); |