Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 16:37:20 +0300
committerJunio C Hamano <gitster@pobox.com>2018-11-13 16:37:20 +0300
commit6c268fdda9dcc421e2bee1ce76496d3e9f96397f (patch)
tree2181f2032e963eef5f5d95968db797435cfefd83 /compat
parentfbfdc07511283a111192e32970bee909016b47d2 (diff)
parent0e218f91c299b0bffa281d3449884a824819a201 (diff)
Merge branch 'js/mingw-perl5lib'
Windows fix. * js/mingw-perl5lib: mingw: unset PERL5LIB by default config: move Windows-specific config settings into compat/mingw.c config: allow for platform-specific core.* config settings config: rename `dummy` parameter to `cb` in git_default_config()
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.c58
-rw-r--r--compat/mingw.h3
2 files changed, 60 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 3b44dd99d79..e8e538a2e04 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -6,6 +6,7 @@
#include "../run-command.h"
#include "../cache.h"
#include "win32/lazyload.h"
+#include "../config.h"
#define HCAST(type, handle) ((type)(intptr_t)handle)
@@ -203,6 +204,35 @@ static int ask_yes_no_if_possible(const char *format, ...)
}
}
+/* Windows only */
+enum hide_dotfiles_type {
+ HIDE_DOTFILES_FALSE = 0,
+ HIDE_DOTFILES_TRUE,
+ HIDE_DOTFILES_DOTGITONLY
+};
+
+static enum hide_dotfiles_type hide_dotfiles = HIDE_DOTFILES_DOTGITONLY;
+static char *unset_environment_variables;
+
+int mingw_core_config(const char *var, const char *value, void *cb)
+{
+ if (!strcmp(var, "core.hidedotfiles")) {
+ if (value && !strcasecmp(value, "dotgitonly"))
+ hide_dotfiles = HIDE_DOTFILES_DOTGITONLY;
+ else
+ hide_dotfiles = git_config_bool(var, value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.unsetenvvars")) {
+ free(unset_environment_variables);
+ unset_environment_variables = xstrdup(value);
+ return 0;
+ }
+
+ return 0;
+}
+
/* Normalizes NT paths as returned by some low-level APIs. */
static wchar_t *normalize_ntpath(wchar_t *wbuf)
{
@@ -1181,6 +1211,27 @@ static wchar_t *make_environment_block(char **deltaenv)
return wenvblk;
}
+static void do_unset_environment_variables(void)
+{
+ static int done;
+ char *p = unset_environment_variables;
+
+ if (done || !p)
+ return;
+ done = 1;
+
+ for (;;) {
+ char *comma = strchr(p, ',');
+
+ if (comma)
+ *comma = '\0';
+ unsetenv(p);
+ if (!comma)
+ break;
+ p = comma + 1;
+ }
+}
+
struct pinfo_t {
struct pinfo_t *next;
pid_t pid;
@@ -1199,9 +1250,12 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
wchar_t wcmd[MAX_PATH], wdir[MAX_PATH], *wargs, *wenvblk = NULL;
unsigned flags = CREATE_UNICODE_ENVIRONMENT;
BOOL ret;
+ HANDLE cons;
+
+ do_unset_environment_variables();
/* Determine whether or not we are associated to a console */
- HANDLE cons = CreateFile("CONOUT$", GENERIC_WRITE,
+ cons = CreateFile("CONOUT$", GENERIC_WRITE,
FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (cons == INVALID_HANDLE_VALUE) {
@@ -2438,6 +2492,8 @@ void mingw_startup(void)
/* fix Windows specific environment settings */
setup_windows_environment();
+ unset_environment_variables = xstrdup("PERL5LIB");
+
/* initialize critical section for waitpid pinfo_t list */
InitializeCriticalSection(&pinfo_cs);
diff --git a/compat/mingw.h b/compat/mingw.h
index a577df0d74a..2f1f8e3e053 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -11,6 +11,9 @@ typedef _sigset_t sigset_t;
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#endif
+extern int mingw_core_config(const char *var, const char *value, void *cb);
+#define platform_core_config mingw_core_config
+
/*
* things that are not available in header files
*/