diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-01-23 15:30:20 +0300 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-02-06 01:02:16 +0300 |
commit | 6d9ba67b0fc2f18c1d7a65514edbdcdf86429c1c (patch) | |
tree | ed60e9bec4aa2adc5aecde724614f3fa4a542971 /builtin-rev-parse.c | |
parent | 98d47d4ccf76725e7833c1bbda1da82f7648925f (diff) |
Commands requiring a work tree must not run in GIT_DIR
This patch helps when you accidentally run something like git-clean
in the git directory instead of the work tree.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-rev-parse.c')
-rw-r--r-- | builtin-rev-parse.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c index 3b716fba13..d53deaa369 100644 --- a/builtin-rev-parse.c +++ b/builtin-rev-parse.c @@ -347,6 +347,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) printf("%s/.git\n", cwd); continue; } + if (!strcmp(arg, "--is-inside-git-dir")) { + printf("%s\n", is_inside_git_dir() ? "true" + : "false"); + continue; + } if (!strncmp(arg, "--since=", 8)) { show_datestring("--max-age=", arg+8); continue; |