Skip to content

Commit bc34e52

Browse files
committed
Merge branch 'js/gfw-system-config-loc-fix'
Update the location of system-side configuration file on Windows. * js/gfw-system-config-loc-fix: config: normalize the path of the system gitconfig cmake(windows): set correct path to the system Git config mingw: move Git for Windows' system config where users expect it
2 parents 508416d + e355307 commit bc34e52

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

config.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,9 +1833,10 @@ static int git_config_from_blob_ref(config_fn_t fn,
18331833
char *git_system_config(void)
18341834
{
18351835
char *system_config = xstrdup_or_null(getenv("GIT_CONFIG_SYSTEM"));
1836-
if (system_config)
1837-
return system_config;
1838-
return system_path(ETC_GITCONFIG);
1836+
if (!system_config)
1837+
system_config = system_path(ETC_GITCONFIG);
1838+
normalize_path_copy(system_config, system_config);
1839+
return system_config;
18391840
}
18401841

18411842
void git_global_config(char **user_out, char **xdg_out)

config.mak.uname

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ ifeq ($(uname_S),Windows)
437437
NO_POSIX_GOODIES = UnfortunatelyYes
438438
NATIVE_CRLF = YesPlease
439439
DEFAULT_HELP_FORMAT = html
440+
ifeq (/mingw64,$(subst 32,64,$(prefix)))
441+
# Move system config into top-level /etc/
442+
ETC_GITCONFIG = ../etc/gitconfig
443+
ETC_GITATTRIBUTES = ../etc/gitattributes
444+
endif
440445

441446
CC = compat/vcbuild/scripts/clink.pl
442447
AR = compat/vcbuild/scripts/lib.pl
@@ -671,6 +676,11 @@ else
671676
USE_LIBPCRE= YesPlease
672677
NO_CURL =
673678
USE_NED_ALLOCATOR = YesPlease
679+
ifeq (/mingw64,$(subst 32,64,$(prefix)))
680+
# Move system config into top-level /etc/
681+
ETC_GITCONFIG = ../etc/gitconfig
682+
ETC_GITATTRIBUTES = ../etc/gitattributes
683+
endif
674684
else
675685
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
676686
NO_CURL = YesPlease

contrib/buildsystems/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,6 @@ list(APPEND compat_SOURCES sha1dc_git.c sha1dc/sha1.c sha1dc/ubc_check.c block-s
223223

224224

225225
add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
226-
ETC_GITATTRIBUTES="etc/gitattributes"
227-
ETC_GITCONFIG="etc/gitconfig"
228226
GIT_EXEC_PATH="libexec/git-core"
229227
GIT_LOCALE_PATH="share/locale"
230228
GIT_MAN_PATH="share/man"
@@ -239,10 +237,15 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
239237

240238
if(WIN32)
241239
set(FALLBACK_RUNTIME_PREFIX /mingw64)
242-
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
240+
# Move system config into top-level /etc/
241+
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
242+
ETC_GITATTRIBUTES="../etc/gitattributes"
243+
ETC_GITCONFIG="../etc/gitconfig")
243244
else()
244245
set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
245-
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
246+
add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}"
247+
ETC_GITATTRIBUTES="etc/gitattributes"
248+
ETC_GITCONFIG="etc/gitconfig")
246249
endif()
247250

248251

0 commit comments

Comments
 (0)