Merge branch 'ma/locate-in-path-for-windows'

"git bisect visualize" stopped running "gitk" on Git for Windows
when the command was reimplemented in C around Git 2.34 timeframe.
This has been corrected.

* ma/locate-in-path-for-windows:
  docs: update when `git bisect visualize` uses `gitk`
  compat/mingw: implement a native locate_in_PATH()
  run-command: conditionally define locate_in_PATH()
This commit is contained in:
Junio C Hamano
2023-08-09 16:18:15 -07:00
4 changed files with 18 additions and 3 deletions

View File

@ -204,9 +204,14 @@ as an alternative to `visualize`):
$ git bisect visualize $ git bisect visualize
------------ ------------
If the `DISPLAY` environment variable is not set, 'git log' is used Git detects a graphical environment through various environment variables:
instead. You can also give command-line options such as `-p` and `DISPLAY`, which is set in X Window System environments on Unix systems.
`--stat`. `SESSIONNAME`, which is set under Cygwin in interactive desktop sessions.
`MSYSTEM`, which is set under Msys2 and Git for Windows.
`SECURITYSESSIONID`, which may be set on macOS in interactive desktop sessions.
If none of these environment variables is set, 'git log' is used instead.
You can also give command-line options such as `-p` and `--stat`.
------------ ------------
$ git bisect visualize --stat $ git bisect visualize --stat

View File

@ -1347,6 +1347,11 @@ static char *path_lookup(const char *cmd, int exe_only)
return prog; return prog;
} }
char *mingw_locate_in_PATH(const char *cmd)
{
return path_lookup(cmd, 0);
}
static const wchar_t *wcschrnul(const wchar_t *s, wchar_t c) static const wchar_t *wcschrnul(const wchar_t *s, wchar_t c)
{ {
while (*s && *s != c) while (*s && *s != c)

View File

@ -177,6 +177,9 @@ pid_t waitpid(pid_t pid, int *status, int options);
#define kill mingw_kill #define kill mingw_kill
int mingw_kill(pid_t pid, int sig); int mingw_kill(pid_t pid, int sig);
#define locate_in_PATH mingw_locate_in_PATH
char *mingw_locate_in_PATH(const char *cmd);
#ifndef NO_OPENSSL #ifndef NO_OPENSSL
#include <openssl/ssl.h> #include <openssl/ssl.h>
static inline int mingw_SSL_set_fd(SSL *ssl, int fd) static inline int mingw_SSL_set_fd(SSL *ssl, int fd)

View File

@ -170,6 +170,7 @@ int is_executable(const char *name)
return st.st_mode & S_IXUSR; return st.st_mode & S_IXUSR;
} }
#ifndef locate_in_PATH
/* /*
* Search $PATH for a command. This emulates the path search that * Search $PATH for a command. This emulates the path search that
* execvp would perform, without actually executing the command so it * execvp would perform, without actually executing the command so it
@ -218,6 +219,7 @@ static char *locate_in_PATH(const char *file)
strbuf_release(&buf); strbuf_release(&buf);
return NULL; return NULL;
} }
#endif
int exists_in_PATH(const char *command) int exists_in_PATH(const char *command)
{ {