git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] More readable 'Not a git repository' messages
@ 2010-08-09 17:24 Ralf Ebert
  2010-08-09 22:14 ` Nguyen Thai Ngoc Duy
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Ralf Ebert @ 2010-08-09 17:24 UTC (permalink / raw)
  To: git

Stating the folder concerned with the operation and wording the
messages differently make them slightly more readable.

old: Not a git repository (or any of the parent directories): .git
new: Not in a git repository: /home/bob/somefolder

old: Not a git repository (or any parent up to mount parent /home/bob)
old: Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM 
not set).
new: Not in a git repository: /home/bob/somefolder
new: (stopped searching at /home because GIT_DISCOVERY_ACROSS_FILESYSTEM 
is not set)

Signed-off-by: Ralf Ebert <info@ralfebert.de>
---
  setup.c |   11 +++++++----
  1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/setup.c b/setup.c
index 2769160..e27fbf1 100644
--- a/setup.c
+++ b/setup.c
@@ -321,6 +321,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
  {
  	const char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);
  	const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
+	char cwd_orig[PATH_MAX];
  	static char cwd[PATH_MAX+1];
  	const char *gitdirenv;
  	const char *gitfile_dir;
@@ -376,8 +377,9 @@ const char *setup_git_directory_gently(int *nongit_ok)
  		die("Not a git repository: '%s'", gitdirenv);
  	}
  -	if (!getcwd(cwd, sizeof(cwd)-1))
+	if (!getcwd(cwd_orig, sizeof(cwd_orig)))
  		die_errno("Unable to read current working directory");
+	strcpy(cwd, cwd_orig);
   	ceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs);
  	if (ceil_offset < 0 && has_dos_drive_prefix(cwd))
@@ -431,7 +433,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
  				*nongit_ok = 1;
  				return NULL;
  			}
-			die("Not a git repository (or any of the parent directories): %s", 
DEFAULT_GIT_DIR_ENVIRONMENT);
+			die("Not in a git repository: %s", cwd_orig);
  		}
  		if (one_filesystem) {
  			if (stat("..", &buf)) {
@@ -446,8 +448,9 @@ const char *setup_git_directory_gently(int *nongit_ok)
  					return NULL;
  				}
  				cwd[offset] = '\0';
-				die("Not a git repository (or any parent up to mount parent %s)\n"
-				"Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM 
not set).", cwd);
+				die("Not in a git repository: %s\n"
+				"(stopped searching at %s because "
+				"GIT_DISCOVERY_ACROSS_FILESYSTEM is not set)", cwd_orig, cwd);
  			}
  		}
  		if (chdir("..")) {
-- 
1.7.2.1.44.g721e7.dirty

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-08-15  3:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-09 17:24 [PATCH] More readable 'Not a git repository' messages Ralf Ebert
2010-08-09 22:14 ` Nguyen Thai Ngoc Duy
2010-08-09 22:44   ` Ralf Ebert
2010-08-09 23:01     ` Jonathan Nieder
2010-08-09 23:34       ` Ralf Ebert
2010-08-10 11:31         ` Nguyen Thai Ngoc Duy
2010-08-10  2:49 ` Sverre Rabbelier
2010-08-10 15:52 ` Jared Hance
2010-08-10 22:34   ` Joshua Juran
2010-08-13 17:25 ` [PATCH/RFC v2] " Ralf Ebert
2010-08-13 17:30   ` Joshua Juran
2010-08-15  2:55   ` [PATCH] setup.c: Improve " Ralf Ebert
2010-08-15  3:36     ` Jonathan Nieder

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).