diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-17 13:50:25 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-17 13:50:25 -0700 |
commit | 3edcc048621fee389be6991c90b6a7dd0386c57e (patch) | |
tree | 936f84111d29e56d42f008999fa3818823853855 /builtin/rev-parse.c | |
parent | Merge branch 'bc/object-id' (diff) | |
parent | rev-parse: add --show-superproject-working-tree (diff) | |
download | tgif-3edcc048621fee389be6991c90b6a7dd0386c57e.tar.xz |
Merge branch 'sb/rev-parse-show-superproject-root'
From a working tree of a repository, a new option of "rev-parse"
lets you ask if the repository is used as a submodule of another
project, and where the root level of the working tree of that
project (i.e. your superproject) is.
* sb/rev-parse-show-superproject-root:
rev-parse: add --show-superproject-working-tree
Diffstat (limited to 'builtin/rev-parse.c')
-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); |