]> git.ipfire.org Git - thirdparty/git.git/commit - help.c
usability: don't ask questions if no reply is required
authorJean-Noel Avila <jn.avila@free.fr>
Thu, 11 May 2017 12:06:32 +0000 (14:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 May 2017 06:18:13 +0000 (15:18 +0900)
commit6c486862636be1fe2d5785451c52f5379b0bad24
treefb66b6b06626b230f60f9bced8d4cc845a7b6dec
parent49800c940790cc7465d1b03e08d472ffd8684808
usability: don't ask questions if no reply is required

There has been a bug report by a corporate user that stated that
"spelling mistake of stash followed by a yes prints character 'y'
infinite times."

This analysis was false. When the spelling of a command contains
errors, the git program tries to help the user by providing candidates
which are close to the unexisting command. E.g Git prints the
following:

        git: 'stahs' is not a git command. See 'git --help'.
        Did you mean this?

        stash

and then exits.

The problem with this hint is that it is not formally indicated as an
hint and the user is in fact encouraged to reply to the question,
whereas the Git command is already finished.

The user was unlucky enough that it was the command he was looking
for, and replied "yes" on the command line, effectively launching the
`yes` program.

The initial error is that the Git programs, when launched in
command-line mode (without interaction) must not ask questions,
because these questions would normally require a user input as a reply
that they won't handle indeed. That's a source of confusion on UX
level.

To improve the general usability of the Git suite, the following rule
was applied:

if the sentence
 * appears in a non-interactive session
 * is printed last before exit
 * is a question addressing the user ("you")

the sentence is turned into affirmative and proposes the option.

The basic rewording of the question sentences has been extended to
other spots found in the source.

Requested at https://github.com/git/git-scm.com/issues/999 by rpai1

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/am.c
builtin/checkout.c
help.c