From: Jonathan Nieder <jrnieder@gmail.com>
To: Ralf Ebert <ralf@ralfebert.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] setup.c: Improve 'Not a git repository' messages
Date: Sat, 14 Aug 2010 22:36:40 -0500 [thread overview]
Message-ID: <20100815033640.GA20486@burratino> (raw)
In-Reply-To: <1281840921-1996-1-git-send-email-ralf@ralfebert.de>
Hi Ralf,
Ralf Ebert wrote:
> +++ b/setup.c
> @@ -431,7 +431,8 @@ 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("No %s repository in %s or its parent directories",
> + DEFAULT_GIT_DIR_ENVIRONMENT, cwd);
So, before:
fatal: Not a git repository (or any of the parent directories): .git
and after:
fatal: No .git repository in /home/jrn/src/some/deeply/nested/path/that/goes/on/for/a/while or its parent directories
The idea being to give a hint to the confused user. That sort of
makes sense, but I would (warning! nitpicks coming!) prefer something
along the lines of
fatal: not a git repository: /home/jrn/src/some/deeply/nested/pa
hint: This means every candidate metadata (.git) directory considered
hint: was invalid in some way.
hint: See "git help repository-layout" for more information.
In other words:
- first, a straightforward error message;
- cutting off user-specified data at some reasonable length
(e.g. 50 chars);
- avoiding overly specific (false) advice and deferring to
documentation for the details.
> @@ -445,9 +446,14 @@ const char *setup_git_directory_gently(int *nongit_ok)
> *nongit_ok = 1;
> 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);
> + const char *home = getenv("HOME");
> + if (home == NULL || strncmp(home, cwd, offset) != 0) {
> + warning("Stopped searching for %s at %.*s "
> + "as GIT_DISCOVERY_ACROSS_FILESYSTEM is not set",
> + DEFAULT_GIT_DIR_ENVIRONMENT, offset, cwd);
> + }
> + die("No %s repository in %s or its parent directories",
> + DEFAULT_GIT_DIR_ENVIRONMENT, cwd);
I don’t understand what’s special about $HOME here.
Would something like the following be okay?
fatal: not a git repository: /home/jrn/src/some/deeply/nested/pa
info: search stopped at mount parent /home
hint: This means every candidate metadata (.git) directory considered
hint: was invalid in some way.
hint: See "git help repository-layout" for more information.
I actually suspect overriding with $GIT_DISCOVERY_ACROSS_FILESYSTEM
would be kind of rare, so it might be okay to let the documentation
take care of explaining that (provided we include a clear pointer).
Just my two cents. Feel free to ignore. :)
prev parent reply other threads:[~2010-08-15 3:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100815033640.GA20486@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=ralf@ralfebert.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).