Re: [PATCH] git.c: Re-introduce sane error messages on missing commands.
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 28, 2006, 10:45 UTC
- Message-ID
- <Pine.LNX.4.63.0606281240480.29667@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <7vr71938t4.fsf@assigned-by-dhcp.cox.net>
Hi,
On Wed, 28 Jun 2006, Junio C Hamano wrote:
Show 11 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > > > Try this: > > > > $ mkdir 5 > > $ cd 5 > > $ git-init-db > > $ rm .git/config # yes, really. > > $ git abc > > Thanks for trying to help, but not really.
Okay. Does not happen with 'next' here, too. I have some changes in my private repo (which eventually should culminate in the big mmap()ed sooper config parsing / writing thingie), which make it break. The following patch fixes this (and potentially Andreas' problem, too).
-- cut here --
[PATCH] save errno in handle_alias()
git.c:main() relies on the value of errno being set by the last attempt to execute the command. However, if something goes awry in handle_alias(), that assumption is wrong. So restore errno before returning from handle_alias().
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
diff --git a/git.c b/git.c index 94e9a4a..7c7106e 100644 --- a/git.c +++ b/git.c @@ -99,7 +99,7 @@ static int split_cmdline(char *cmdline, static int handle_alias(int *argcp, const char ***argv) { - int nongit = 0, ret = 0; + int nongit = 0, ret = 0, saved_errno = errno; const char *subdir; subdir = setup_git_directory_gently(&nongit); @@ -137,6 +137,8 @@ static int handle_alias(int *argcp, cons if (subdir) chdir(subdir); + errno = saved_errno; + return ret; }