X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=rev-parse.c;h=0c951af0d49da459fc6c85c32707b016bf581a57;hb=af6e277c5eddbcf82582b4bbd3e50b36aa61a20a;hp=bb4949ad70364abdf7c3bbca357e5ebc42880614;hpb=1e9eb2e93747d2ee3fb44a5a2c8a48e7d19819b9;p=git.git diff --git a/rev-parse.c b/rev-parse.c index bb4949ad..0c951af0 100644 --- a/rev-parse.c +++ b/rev-parse.c @@ -216,6 +216,18 @@ int main(int argc, char **argv) puts(prefix); continue; } + if (!strcmp(arg, "--show-cdup")) { + const char *pfx = prefix; + while (pfx) { + pfx = strchr(pfx, '/'); + if (pfx) { + pfx++; + printf("../"); + } + } + putchar('\n'); + continue; + } if (!strcmp(arg, "--git-dir")) { const char *gitdir = getenv(GIT_DIR_ENVIRONMENT); static char cwd[PATH_MAX];