Re: [PATCH] checkout: Better error message on invalid branch name

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] checkout: Better error message on invalid branch name

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:59

Ævar Arnfjörð Bjarmason [off-list ref] writes:
Change the error message for `git checkout -b "I LOVE YOU"' and other
invalid branch names to say what branch names are invalid, rather than
just saying we don't like it.

Before:

    $ git checkout -b "I LOVE YOU"
    fatal: git checkout: we do not like 'I LOVE YOU' as a branch name.

After:

    $ git checkout -b "I LOVE YOU"
    fatal: git checkout: The name "I LOVE YOU" is not a valid Git branch name.
    A branch name can not:
        - Have a path component that begins with "."
        - Have a double dot ".."
        - Have an ASCII control character, "~", "^", ":" or SP, anywhere
        - End with a "/"
        - End with ".lock"
        - Contain a "\" (backslash
Cluttering the output without protecting it with "advice" does not look
like a "fix" nor improvement.

Re: [PATCH] checkout: Better error message on invalid branch name

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:48:59

On Mon, Jun 21, 2010 at 20:58, Junio C Hamano [off-list ref] wrote:
Cluttering the output without protecting it with "advice" does not look
like a "fix" nor improvement.
The short version of the message would also need to be fixed then, to
do that properly would require bigger changes in the return code of
bad_ref_char and the functions that call it. Then we could have e.g.:

    $ git checkout -b "I LOVE YOU"
    fatal: git checkout: Branch name cannot contain ' ';  marked by
<-- HERE in 'I ' <-- HERE

Similar to what you get from:

    $ perl -e '/I LOVE [/'

That would also make the long version unnecessary, and maybe improve
some other error messages that deal with ref names.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help