From: Ralf Ebert Date: Mon, 09 Aug 2010 22:44:56 GMT Subject: Re: [PATCH] More readable 'Not a git repository' messages Message-ID: In-Reply-To: Hi Duy, > 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