* What is 'git BRANCH'?
@ 2008-07-29 22:18 Jurko Gospodnetić
2008-07-29 22:24 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Jurko Gospodnetić @ 2008-07-29 22:18 UTC (permalink / raw)
To: git
Hi.
I typed in "git BRANCH" by accident and got the error message:
"fatal: cannot handle BRANCH internally".
What does that mean?
It is different from the usual "git: 'yada-yada' is not a
git-command. See 'git --help'." message you get when you type in an
incorrect command name.
Just curious...
Best regards,
Jurko Gospodnetić
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: What is 'git BRANCH'? 2008-07-29 22:18 What is 'git BRANCH'? Jurko Gospodnetić @ 2008-07-29 22:24 ` Junio C Hamano 2008-07-29 22:32 ` Kevin Ballard 2008-07-29 22:39 ` Junio C Hamano 0 siblings, 2 replies; 8+ messages in thread From: Junio C Hamano @ 2008-07-29 22:24 UTC (permalink / raw) To: Jurko Gospodnetić; +Cc: git Jurko Gospodnetić <jurko.gospodnetic@docte.hr> writes: > Hi. > > I typed in "git BRANCH" by accident and got the error message: > "fatal: cannot handle BRANCH internally". > > What does that mean? > > It is different from the usual "git: 'yada-yada' is not a > git-command. See 'git --help'." message you get when you type in an > incorrect command name. Just a guess; your git is installed on a case-challenged filesystem? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: What is 'git BRANCH'? 2008-07-29 22:24 ` Junio C Hamano @ 2008-07-29 22:32 ` Kevin Ballard 2008-07-29 22:43 ` Jurko Gospodnetić 2008-07-29 22:39 ` Junio C Hamano 1 sibling, 1 reply; 8+ messages in thread From: Kevin Ballard @ 2008-07-29 22:32 UTC (permalink / raw) To: Junio C Hamano; +Cc: Jurko Gospodnetić, git On Jul 29, 2008, at 3:24 PM, Junio C Hamano wrote: > Jurko Gospodnetić <jurko.gospodnetic@docte.hr> writes: > >> Hi. >> >> I typed in "git BRANCH" by accident and got the error message: >> "fatal: cannot handle BRANCH internally". >> >> What does that mean? >> >> It is different from the usual "git: 'yada-yada' is not a >> git-command. See 'git --help'." message you get when you type in an >> incorrect command name. > > Just a guess; your git is installed on a case-challenged filesystem? From what I can tell, this happens when you execute one of the git-* builtin binaries using a name that doesn't actually match the binary, case-sensitively. When you type `git BRANCH` on OS X, git matches that against the git-branch binary and executes it, but argv[0] contains "git-BRANCH". When this is compared by the git-branch binary to the list of internal commands, it comes up empty, and the fallback code (to die with "fatal: cannot handle BRANCH internally") gets executed instead. In other words, this is identical to running `/usr/local/libexec/git- core/git-BRANCH` or to doing something like `exec -a git-BRANCH /usr/ local/libexec/git-core/git-branch` (this example should work on any filesystem). -Kevin Ballard -- Kevin Ballard http://kevin.sb.org kevin@sb.org http://www.tildesoft.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: What is 'git BRANCH'? 2008-07-29 22:32 ` Kevin Ballard @ 2008-07-29 22:43 ` Jurko Gospodnetić 0 siblings, 0 replies; 8+ messages in thread From: Jurko Gospodnetić @ 2008-07-29 22:43 UTC (permalink / raw) To: git; +Cc: Junio C Hamano Hi all. > On Jul 29, 2008, at 3:24 PM, Junio C Hamano wrote: > >> Jurko Gospodnetić <jurko.gospodnetic@docte.hr> writes: >> >>> Hi. >>> >>> I typed in "git BRANCH" by accident and got the error message: >>> "fatal: cannot handle BRANCH internally". >>> >>> What does that mean? >>> >>> It is different from the usual "git: 'yada-yada' is not a >>> git-command. See 'git --help'." message you get when you type in an >>> incorrect command name. >> >> Just a guess; your git is installed on a case-challenged filesystem? Thank you all for explaining this, and yes - this was detected on Windows with a NTFS drive set to case-insensitive. But, if something is running git-branch here... why does this script/executable/whatever try to check the name it got called with? Why does it not simply do its work no matter the name it got called with? If I'm asking something to obvious here - feel free to send me back to read the code... :-) Best regards, Jurko Gospodnetić ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: What is 'git BRANCH'? 2008-07-29 22:24 ` Junio C Hamano 2008-07-29 22:32 ` Kevin Ballard @ 2008-07-29 22:39 ` Junio C Hamano 2008-07-29 22:49 ` Sverre Rabbelier 2008-07-29 23:45 ` Eric Raible 1 sibling, 2 replies; 8+ messages in thread From: Junio C Hamano @ 2008-07-29 22:39 UTC (permalink / raw) To: Jurko Gospodnetić; +Cc: git Junio C Hamano <gitster@pobox.com> writes: > Jurko Gospodnetić <jurko.gospodnetic@docte.hr> writes: > >> Hi. >> >> I typed in "git BRANCH" by accident and got the error message: >> "fatal: cannot handle BRANCH internally". >> >> What does that mean? >> >> It is different from the usual "git: 'yada-yada' is not a >> git-command. See 'git --help'." message you get when you type in an >> incorrect command name. > > Just a guess; your git is installed on a case-challenged filesystem? Yeah, that must be it. This can happen on MacOS and Windows, I would imagine. -- >8 -- [PATCH] Fail on unknown command sensibly on case-challenged filesystems The callchain on a case-challenged filesystem when the user runs "git BRANCH" looks like this: - main(): git BRANCH - execv_dashed_external("BRANCH") - execvp("git-BRANCH") - main(): git-BRANCH - prefixcmp("git-BRANCH", "git-") - handle_internal_command() struct cmd_struct commands[] does not have "BRANCH" so it returns, instead of exiting. When the "git wrapper" execs "git-BRANCH", if your filesystem knows "branch" and "BRANCH" are different, execvp() would fail and we will see the familiar error message from the git.c::main(). However, if execvp() succeeds, we feed an unknown command name to handle_internal_command() and it triggers a different error message. Signed-off-by: Junio C Hamano <gitster@pobox.com> --- git.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git.c b/git.c index 37b1d76..c99e769 100644 --- a/git.c +++ b/git.c @@ -448,7 +448,7 @@ int main(int argc, const char **argv) cmd += 4; argv[0] = cmd; handle_internal_command(argc, argv); - die("cannot handle %s internally", cmd); + help_unknown_cmd(cmd); } /* Look for flags.. */ ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: What is 'git BRANCH'? 2008-07-29 22:39 ` Junio C Hamano @ 2008-07-29 22:49 ` Sverre Rabbelier 2008-07-30 5:14 ` Jeff King 2008-07-29 23:45 ` Eric Raible 1 sibling, 1 reply; 8+ messages in thread From: Sverre Rabbelier @ 2008-07-29 22:49 UTC (permalink / raw) To: Junio C Hamano; +Cc: Jurko Gospodnetić, git On Wed, Jul 30, 2008 at 00:39, Junio C Hamano <gitster@pobox.com> wrote: > diff --git a/git.c b/git.c > index 37b1d76..c99e769 100644 > --- a/git.c > +++ b/git.c > @@ -448,7 +448,7 @@ int main(int argc, const char **argv) > cmd += 4; > argv[0] = cmd; > handle_internal_command(argc, argv); > - die("cannot handle %s internally", cmd); > + help_unknown_cmd(cmd); > } > > /* Look for flags.. */ Why does handle_internal_command not complain after the " for (i = 0; i < ARRAY_SIZE(commands); i++) {" that no matching commands were found? Is that not an implicit assertion that would do well with being asserted here? -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: What is 'git BRANCH'? 2008-07-29 22:49 ` Sverre Rabbelier @ 2008-07-30 5:14 ` Jeff King 0 siblings, 0 replies; 8+ messages in thread From: Jeff King @ 2008-07-30 5:14 UTC (permalink / raw) To: sverre; +Cc: Junio C Hamano, Jurko Gospodnetić, git On Wed, Jul 30, 2008 at 12:49:00AM +0200, Sverre Rabbelier wrote: > Why does handle_internal_command not complain after the " for (i = 0; > i < ARRAY_SIZE(commands); i++) {" that no matching commands were > found? Is that not an implicit assertion that would do well with being > asserted here? Because it is called from two places. In one, we _know_ that this must be internal, so we die right after. In the other, we try internal, then external, then alias. So we don't want to die. Grep for handle_internal_cmmand in git.c. -Peff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: What is 'git BRANCH'? 2008-07-29 22:39 ` Junio C Hamano 2008-07-29 22:49 ` Sverre Rabbelier @ 2008-07-29 23:45 ` Eric Raible 1 sibling, 0 replies; 8+ messages in thread From: Eric Raible @ 2008-07-29 23:45 UTC (permalink / raw) To: git Junio C Hamano <gitster <at> pobox.com> writes: > diff --git a/git.c b/git.c > index 37b1d76..c99e769 100644 > --- a/git.c > +++ b/git.c > @@ -448,7 +448,7 @@ int main(int argc, const char **argv) > cmd += 4; > argv[0] = cmd; > handle_internal_command(argc, argv); > - die("cannot handle %s internally", cmd); > + help_unknown_cmd(cmd); > } Which on windows leads to the less-than-friendly: git BRANCH => git: 'BRANCH.exe' is not a git-command. See 'git --help'. I wonder if it wouldn't be better to simply to a case-insensitive comparison when comparing against the builtin array. Alternatively, at least the the extension (if any) ought to be stripped. I'd be glad to come up with the patch for either given the word... - Eric ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-07-30 5:15 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-07-29 22:18 What is 'git BRANCH'? Jurko Gospodnetić 2008-07-29 22:24 ` Junio C Hamano 2008-07-29 22:32 ` Kevin Ballard 2008-07-29 22:43 ` Jurko Gospodnetić 2008-07-29 22:39 ` Junio C Hamano 2008-07-29 22:49 ` Sverre Rabbelier 2008-07-30 5:14 ` Jeff King 2008-07-29 23:45 ` Eric Raible
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox