Merge branch 'sb/pack-protocol-doc-nak' into maint
[gitweb.git] / builtin / submodule--helper.c
index f0b2c4fe0bb4b71b3ccd7002702191ea4f46469e..926d2051623be390d5de2611d81d5fe9f39a8169 100644 (file)
@@ -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}