summaryrefslogtreecommitdiff
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-06-06 21:18:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-06 21:18:55 (GMT)
commit283badc38e99f1dcdbb7bc5f6b5b3ace886b3bfd (patch)
tree5168e44f2770f0da95150fc27a16071a52448433 /builtin/submodule--helper.c
parentf6136f3c39a4e7b9b98c11e69d38e15f5705204b (diff)
parent44431df02459ec6c4d8c705dd15f376015407043 (diff)
downloadgit-283badc38e99f1dcdbb7bc5f6b5b3ace886b3bfd.zip
git-283badc38e99f1dcdbb7bc5f6b5b3ace886b3bfd.tar.gz
git-283badc38e99f1dcdbb7bc5f6b5b3ace886b3bfd.tar.bz2
Merge branch 'sb/submodule-helper-relative-path'
A bash-ism "local" has been removed from "git submodule" scripted Porcelain. * sb/submodule-helper-relative-path: submodule: remove bashism from shell script
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index f0b2c4f..926d205 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -831,6 +831,17 @@ static int update_clone(int argc, const char **argv, const char *prefix)
return 0;
}
+static int resolve_relative_path(int argc, const char **argv, const char *prefix)
+{
+ struct strbuf sb = STRBUF_INIT;
+ if (argc != 3)
+ die("submodule--helper relative_path takes exactly 2 arguments, got %d", argc);
+
+ printf("%s", relative_path(argv[1], argv[2], &sb));
+ strbuf_release(&sb);
+ return 0;
+}
+
struct cmd_struct {
const char *cmd;
int (*fn)(int, const char **, const char *);
@@ -841,6 +852,7 @@ static struct cmd_struct commands[] = {
{"name", module_name},
{"clone", module_clone},
{"update-clone", update_clone},
+ {"relative-path", resolve_relative_path},
{"resolve-relative-url", resolve_relative_url},
{"resolve-relative-url-test", resolve_relative_url_test},
{"init", module_init}