about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--cgit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cgit.c b/cgit.c
index 0bf8972..4dadd97 100644
--- a/cgit.c
+++ b/cgit.c
@@ -486,8 +486,10 @@ static int prepare_repo_cmd(struct cgit_context *ctx)
 	init_display_notes(NULL);
 
 	/* We restore the unset variables afterward. */
-	setenv("HOME", user_home, 1);
-	setenv("XDG_CONFIG_HOME", xdg_home, 1);
+	if (user_home)
+		setenv("HOME", user_home, 1);
+	if (xdg_home)
+		setenv("XDG_CONFIG_HOME", xdg_home, 1);
 
 	if (nongit) {
 		const char *name = ctx->repo->name;
ver-highlight'> 2021-01-20Use mtags in source-filterJune McEnroe 2021-01-19Add mtags to generate tags for make and mdocJune McEnroe 2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe 2021-01-19Don't use a pager if reading standard inputJune McEnroe 2021-01-19Support BSD make syntax and match *.amJune McEnroe These don't really go together, but... 2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe Otherwise it ends up going into Shell state. 2021-01-18Allow matching lexers using first input lineJune McEnroe