Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Jurko Gospodnetić" <jurko.gospodnetic@docte.hr>
Cc: git@vger.kernel.org
Subject: Re: What is 'git BRANCH'?
Date: Tue, 29 Jul 2008 15:39:36 -0700	[thread overview]
Message-ID: <7v63qob9hz.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vej5cba6z.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Tue, 29 Jul 2008 15:24:36 -0700")

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.. */

  parent reply	other threads:[~2008-07-29 22:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-07-29 22:49     ` Sverre Rabbelier
2008-07-30  5:14       ` Jeff King
2008-07-29 23:45     ` Eric Raible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v63qob9hz.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jurko.gospodnetic@docte.hr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox