Skip to content

Commit

Permalink
Merge pull request #3751 from rkitover/native-term
Browse files Browse the repository at this point in the history
mingw: set $env:TERM=xterm-256color for newer OSes
  • Loading branch information
dscho committed Apr 26, 2022
2 parents 63f79b0 + f8248ab commit 92018ae
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
2 changes: 2 additions & 0 deletions builtin/bisect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,8 @@ int cmd_bisect(int argc, const char **argv, const char *prefix)

git_config(git_default_config, NULL);

git_config(git_default_config, NULL);

argc -= 2;
argv += 2;

Expand Down
11 changes: 11 additions & 0 deletions builtin/update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,17 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
the_index.version = preferred_index_format;
}

/*
* It is possible, though unlikely, that a caller could use the verbose
* output to synchronize with addition of objects to the object
* database. The current implementation of ODB transactions leaves
* objects invisible while a transaction is active, so end the
* transaction here if verbose output is enabled.
*/

if (verbose)
end_odb_transaction();

if (read_from_stdin) {
struct strbuf buf = STRBUF_INIT;
struct strbuf unquoted = STRBUF_INIT;
Expand Down
3 changes: 3 additions & 0 deletions ci/run-test-slice.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ handle_failed_tests
# Run the git subtree tests only if main tests succeeded
test 0 != "$1" || make -C contrib/subtree test

# Run the git subtree tests only if main tests succeeded
test 0 != "$1" || make -C contrib/subtree test

check_unignored_build_artifacts
17 changes: 14 additions & 3 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3378,9 +3378,20 @@ static void setup_windows_environment(void)
convert_slashes(tmp);
}

/* simulate TERM to enable auto-color (see color.c) */
if (!getenv("TERM"))
setenv("TERM", "cygwin", 1);

/*
* Make sure TERM is set up correctly to enable auto-color
* (see color.c .) Use "cygwin" for older OS releases which
* works correctly with MSYS2 utilities on older consoles.
*/
if (!getenv("TERM")) {
if ((GetVersion() >> 16) < 15063)
setenv("TERM", "cygwin", 0);
else {
setenv("TERM", "xterm-256color", 0);
setenv("COLORTERM", "truecolor", 0);
}
}

/* calculate HOME if not set */
if (!getenv("HOME")) {
Expand Down
6 changes: 6 additions & 0 deletions fsmonitor-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ void fsm_settings__set_ipc(struct repository *r)
if (!r->settings.fsmonitor)
r->settings.fsmonitor = alloc_settings();

if (check_for_incompatible(r))
return;

r->settings.fsmonitor->mode = FSMONITOR_MODE_IPC;
r->settings.fsmonitor->reason = reason;
FREE_AND_NULL(r->settings.fsmonitor->hook_path);
Expand All @@ -180,6 +183,9 @@ void fsm_settings__set_hook(struct repository *r, const char *path)
if (!r->settings.fsmonitor)
r->settings.fsmonitor = alloc_settings();

if (check_for_incompatible(r))
return;

r->settings.fsmonitor->mode = FSMONITOR_MODE_HOOK;
r->settings.fsmonitor->reason = reason;
FREE_AND_NULL(r->settings.fsmonitor->hook_path);
Expand Down

0 comments on commit 92018ae

Please sign in to comment.