Skip to content

Commit 595d29b

Browse files
dschoGit for Windows Build Agent
authored andcommitted
fixup??? git: catch an attempt to run "git-foo"
This is needed to handle the case where `argv[0]` contains the full path (which is the case on Windows) and the suffix `.exe` (which is also the case on Windows). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b2e4cd9 commit 595d29b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

git.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,8 @@ int cmd_main(int argc, const char **argv)
876876
* that one cannot handle it.
877877
*/
878878
if (skip_prefix(cmd, "git-", &cmd)) {
879-
warn_on_dashed_git(argv[0]);
879+
strip_extension(&cmd);
880+
warn_on_dashed_git(cmd);
880881

881882
argv[0] = cmd;
882883
handle_builtin(argc, argv);

help.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,9 +745,12 @@ NORETURN void help_unknown_ref(const char *ref, const char *cmd,
745745
static struct cmdname_help *find_cmdname_help(const char *name)
746746
{
747747
int i;
748+
const char *p;
748749

750+
skip_prefix(name, "git-", &name);
749751
for (i = 0; i < ARRAY_SIZE(command_list); i++) {
750-
if (!strcmp(command_list[i].name, name))
752+
if (skip_prefix(command_list[i].name, "git-", &p) &&
753+
!strcmp(p, name))
751754
return &command_list[i];
752755
}
753756
return NULL;

0 commit comments

Comments
 (0)