summaryrefslogtreecommitdiff
path: root/rev-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'rev-parse.c')
-rw-r--r--rev-parse.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/rev-parse.c b/rev-parse.c
index bb4949ad70..0c951af0d4 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];