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>
This commit is contained in:
Johannes Schindelin
2007-01-23 13:30:20 +01:00
committed by Junio C Hamano
parent 98d47d4ccf
commit 6d9ba67b0f
4 changed files with 19 additions and 4 deletions

View File

@ -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;