Re: [PATCH] More readable 'Not a git repository' messages
- From
Ralf Ebert <info@ralfebert.de>
- Date
- Aug 9, 2010, 22:44 UTC
- Message-ID
- <i3q0d8$m8f$1@dough.gmane.org>
- In-Reply-To
- <AANLkTinttmKi4+EbE54r-GeRbN3_2wxUHu_qJMn5Nysn@mail.gmail.com>
Hi Duy,
Show 11 quoted lines
> How about this and avoid adding cwd_orig?
>
> - 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, offset, cwd);this code is inside a loop that goes up in the directory hierarchy. So cwd[offset] = '\0' does not only happen once before dying. Maybe it could be done without copying but I thought keeping a copy of the unaltered path might be more readable.
-- Ralf