Skip to content
  • Jean-Noël Avila's avatar
    usability: don't ask questions if no reply is required · 6c486862
    Jean-Noël Avila authored and Junio C Hamano's avatar Junio C Hamano committed
    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: default avatarJean-Noel Avila <jn.avila@free.fr>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    6c486862