Always show which directory is not a git repository
Unify all fatal: Not a git repository error messages so they include path information. Signed-off-by: Richard Hartmann <richih@net.in.tum.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Richard Hartmann committed
Dec 22, 2008 at 00:17 UTC
f66bc5f928194366ee5eb78ef18a3562fb1bb7cf
3 files changed
+4
-4
contrib/workdir/git-new-workdir
+1
-1
@@ -22,7 +22,7 @@ branch=$3
22
# want to make sure that what is pointed to has a .git directory ...
23
git_dir=$(cd "$orig_git" 2>/dev/null &&
24
git rev-parse --git-dir 2>/dev/null) ||
25
- die "\"$orig_git\" is not a git repository!"
25
+ die "Not a git repository: \"$orig_git\""
26
27
case "$git_dir" in
28
.git)
perl/Git.pm
+2
-2
@@ -204,14 +204,14 @@ sub repository {
204
205
unless (-d "$dir/refs" and -d "$dir/objects" and -e "$dir/HEAD") {
206
# Mimick git-rev-parse --git-dir error message:
207
- throw Error::Simple('fatal: Not a git repository');
207
+ throw Error::Simple("fatal: Not a git repository: $dir");
208
}
209
my $search = Git->repository(Repository => $dir);
210
try {
211
$search->command('symbolic-ref', 'HEAD');
212
} catch Git::Error::Command with {
213
# Mimick git-rev-parse --git-dir error message:
214
- throw Error::Simple('fatal: Not a git repository');
214
+ throw Error::Simple("fatal: Not a git repository: $dir");
215
}
216
217
$opts{Repository} = abs_path($dir);
setup.c
+1
-1
@@ -468,7 +468,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
468
*nongit_ok = 1;
469
return NULL;
470
}
471
- die("Not a git repository");
471
+ die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT);
472
}
473
if (chdir(".."))
474
die("Cannot change to %s/..: %s", cwd, strerror(errno));