[PATCH] Do not load system gitconfig and gitattributes
john at keeping.me.uk
Mon Apr 8 20:52:20 CEST 2013
Since we do not explicitly configure Git's build, the system
configuration directory will point at $HOME/etc which is unlikely to be
useful and may be very bad, for example if the user builds as root then
the files will be inaccessible and cause CGit to exit prematurely.
Fix this by exporting GIT_ATTR_NOSYSTEM=1 and GIT_CONFIG_NOSYSTEM=1 at
the beginning of main. Note that we use setenv with overwrite=0 so that
users who require this functionality can still get it by setting the
variables to "0" or "false" before invoking CGit.
Reported-by: Ferry Huberts <ferry.huberts at pelagic.nl>
Signed-off-by: John Keeping <john at keeping.me.uk>
On Mon, Apr 08, 2013 at 08:48:19PM +0200, Jason A. Donenfeld wrote:
> On Mon, Apr 8, 2013 at 8:47 PM, John Keeping <john at keeping.me.uk> wrote:
> > There was a change in Git to promote permission denied from a silent
> > failure to a warning (IIRC). I'm surprised that this causes CGit to
> > exit but I haven't followed that code carefully.
> Triaging. Standby.
I think this patch is sensible regardless of the cause...
cgit.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cgit.c b/cgit.c
index f73c7b0..78805c7 100644
@@ -815,6 +815,9 @@ int main(int argc, const char **argv)
const char *path;
int err, ttl;
+ setenv("GIT_ATTR_NOSYSTEM", "1", 0);
+ setenv("GIT_CONFIG_NOSYSTEM", "1", 0);
cgit_repolist.length = 0;
cgit_repolist.count = 0;
More information about the CGit