cgit

commit 034e3c7d56ba71ce281886fe8525b16d4559fac1

Author: Christian Hesse <mail@eworm.de>

git: update to v2.22.0

Update to git version v2.22.0.

Upstream commit bce9db6d ("trace2: use system/global config for default
trace2 settings") caused a regression. We have to unset HOME and
XDG_CONFIG_HOME before early loading of config from trace2 code kicks in.

Signed-off-by: Christian Hesse <mail@eworm.de>

 Makefile | 2 +-
 cgit.c | 17 +++++++++++------


diff --git a/Makefile b/Makefile
index 40f4fd884f4c90a2b4d75eeb8e11bbf2c1d65fa9..b2bd3514f8c9b0c9f27c5f4325da04e9b4552a6f 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ htmldir = $(docdir)
 pdfdir = $(docdir)
 mandir = $(prefix)/share/man
 SHA1_HEADER = <openssl/sha.h>
-GIT_VER = 2.21.0
+GIT_VER = 2.22.0
 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz
 INSTALL = install
 COPYTREE = cp -r




diff --git a/cgit.c b/cgit.c
index 2910d4b861d76df28b14f6712d30e3568f4ab65b..ac8c6418ba46061da375fe26c82b39d1be6e51fc 100644
--- a/cgit.c
+++ b/cgit.c
@@ -19,6 +19,16 @@ #include "scan-tree.h"
 
 const char *cgit_version = CGIT_VERSION;
 
+__attribute__((constructor))
+static void constructor_environment()
+{
+	/* Do not look in /etc/ for gitconfig and gitattributes. */
+	setenv("GIT_CONFIG_NOSYSTEM", "1", 1);
+	setenv("GIT_ATTR_NOSYSTEM", "1", 1);
+	unsetenv("HOME");
+	unsetenv("XDG_CONFIG_HOME");
+}
+
 static void add_mimetype(const char *name, const char *value)
 {
 	struct string_list_item *item;
@@ -565,18 +575,13 @@ {
 	/* The path to the git repository. */
 	setenv("GIT_DIR", ctx.repo->path, 1);
 
-	/* Do not look in /etc/ for gitconfig and gitattributes. */
-	setenv("GIT_CONFIG_NOSYSTEM", "1", 1);
-	setenv("GIT_ATTR_NOSYSTEM", "1", 1);
-	unsetenv("HOME");
-	unsetenv("XDG_CONFIG_HOME");
-
 	/* Setup the git directory and initialize the notes system. Both of these
 	 * load local configuration from the git repository, so we do them both while
 	 * the HOME variables are unset. */
 	setup_git_directory_gently(nongit);
 	init_display_notes(NULL);
 }
+
 static int prepare_repo_cmd(int nongit)
 {
 	struct object_id oid;