X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=rev-parse.c;h=0c951af0d49da459fc6c85c32707b016bf581a57;hb=cfee10a773be0f8d0024f2567164c910d4213244;hp=bb4949ad70364abdf7c3bbca357e5ebc42880614;hpb=8fc66df237afce0b4318657f166b3583831949f3;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];