Skip to content

Commit

Permalink
Always show which directory is not a git repository
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Richard Hartmann authored and Junio C Hamano committed Dec 22, 2008
1 parent 5fdb709 commit f66bc5f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contrib/workdir/git-new-workdir
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions perl/Git.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f66bc5f

Please sign in to comment.