mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
strip extension and handle DRIVE: notation
This commit is contained in:
committed by
Johannes Sixt
parent
8d1bfddd0c
commit
9c6663c419
3
Makefile
3
Makefile
@@ -425,7 +425,8 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NO_STRCASESTR=YesPlease
|
||||
NO_STRLCPY=YesPlease
|
||||
NO_ICONV=YesPlease
|
||||
COMPAT_CFLAGS += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -I compat
|
||||
NO_SVN_TESTS=YesPlease
|
||||
COMPAT_CFLAGS += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -I compat
|
||||
COMPAT_OBJS += compat/mingw.o compat/fnmatch.o
|
||||
EXTLIBS += -lws2_32 -lregex
|
||||
X = .exe
|
||||
|
||||
19
git.c
19
git.c
@@ -280,6 +280,15 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
|
||||
};
|
||||
int i;
|
||||
|
||||
#ifdef STRIP_EXTENSION
|
||||
i = strlen(argv[0]) - strlen(STRIP_EXTENSION);
|
||||
if (i > 0 && !strcmp(argv[0] + i, STRIP_EXTENSION)) {
|
||||
char *argv0 = strdup(argv[0]);
|
||||
argv[0] = cmd = argv0;
|
||||
argv0[i] = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Turn "git cmd --help" into "git help cmd" */
|
||||
if (argc > 1 && !strcmp(argv[1], "--help")) {
|
||||
argv[1] = argv[0];
|
||||
@@ -325,6 +334,16 @@ int main(int argc, const char **argv, char **envp)
|
||||
cmd = slash;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
slash = strrchr(cmd, '\\');
|
||||
if (slash) {
|
||||
*slash++ = 0;
|
||||
if (cmd[1] == ':')
|
||||
exec_path = cmd;
|
||||
cmd = slash;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "git-xxxx" is the same as "git xxxx", but we obviously:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user