Code

Always show which directory is not a git repository
authorRichard Hartmann <richih.mailinglist@gmail.com>
Sun, 21 Dec 2008 23:17:32 +0000 (00:17 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Dec 2008 02:46:41 +0000 (18:46 -0800)
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>
contrib/workdir/git-new-workdir
perl/Git.pm
setup.c

index 7959eab902d28bb3307c542514ca4c5f49deee0f..993cacf324b8595e5be583ff372b25353c7af95c 100755 (executable)
@@ -22,7 +22,7 @@ branch=$3
 # want to make sure that what is pointed to has a .git directory ...
 git_dir=$(cd "$orig_git" 2>/dev/null &&
   git rev-parse --git-dir 2>/dev/null) ||
-  die "\"$orig_git\" is not a git repository!"
+  die "Not a git repository: \"$orig_git\""
 
 case "$git_dir" in
 .git)
index dde9105df8464911451830321e4da1cbae924955..8392a68333cd57b899962ef6a7a9ca80dd5d583d 100644 (file)
@@ -204,14 +204,14 @@ sub repository {
 
                        unless (-d "$dir/refs" and -d "$dir/objects" and -e "$dir/HEAD") {
                                # Mimick git-rev-parse --git-dir error message:
-                               throw Error::Simple('fatal: Not a git repository');
+                               throw Error::Simple("fatal: Not a git repository: $dir");
                        }
                        my $search = Git->repository(Repository => $dir);
                        try {
                                $search->command('symbolic-ref', 'HEAD');
                        } catch Git::Error::Command with {
                                # Mimick git-rev-parse --git-dir error message:
-                               throw Error::Simple('fatal: Not a git repository');
+                               throw Error::Simple("fatal: Not a git repository: $dir");
                        }
 
                        $opts{Repository} = abs_path($dir);
diff --git a/setup.c b/setup.c
index 833ced2269ae45b08f381fb2644b74f47cf50d1a..6b277b6a11d3d8419d79a93628b9923001a065a6 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -468,7 +468,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
                                *nongit_ok = 1;
                                return NULL;
                        }
-                       die("Not a git repository");
+                       die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT);
                }
                if (chdir(".."))
                        die("Cannot change to %s/..: %s", cwd, strerror(errno));