mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Hand-roll the search for the program name to remove #ifdef MINGW.
We now use is_dir_sep() to scan argv[0] for the program name. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
14
git.c
14
git.c
@@ -396,8 +396,8 @@ static void handle_internal_command(int argc, const char **argv)
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
const char *cmd = argv[0] ? argv[0] : "git-help";
|
||||
char *slash = strrchr(cmd, '/');
|
||||
const char *cmd = argv[0] && *argv[0] ? argv[0] : "git-help";
|
||||
char *slash = (char *)cmd + strlen(cmd);
|
||||
const char *cmd_path = NULL;
|
||||
int done_alias = 0;
|
||||
|
||||
@@ -406,12 +406,10 @@ int main(int argc, const char **argv)
|
||||
* name, and the dirname as the default exec_path
|
||||
* if we don't have anything better.
|
||||
*/
|
||||
#ifdef __MINGW32__
|
||||
char *bslash = strrchr(cmd, '\\');
|
||||
if (!slash || (bslash && bslash > slash))
|
||||
slash = bslash;
|
||||
#endif
|
||||
if (slash) {
|
||||
do
|
||||
--slash;
|
||||
while (cmd <= slash && !is_dir_sep(*slash));
|
||||
if (cmd <= slash) {
|
||||
*slash++ = 0;
|
||||
cmd_path = cmd;
|
||||
cmd = slash;
|
||||
|
||||
Reference in New Issue
Block a user