Skip to content

Commit d7faeb1

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 fbd7eb0 commit d7faeb1

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
@@ -726,9 +726,12 @@ NORETURN void help_unknown_ref(const char *ref, const char *cmd,
726726
static struct cmdname_help *find_cmdname_help(const char *name)
727727
{
728728
int i;
729+
const char *p;
729730

731+
skip_prefix(name, "git-", &name);
730732
for (i = 0; i < ARRAY_SIZE(command_list); i++) {
731-
if (!strcmp(command_list[i].name, name))
733+
if (skip_prefix(command_list[i].name, "git-", &p) &&
734+
!strcmp(p, name))
732735
return &command_list[i];
733736
}
734737
return NULL;

0 commit comments

Comments
 (0)