diff options
author | Jeff King <peff@peff.net> | 2012-02-03 17:16:02 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-03 14:37:04 -0800 |
commit | 84d72733fc8cb90ac7fef04bb114da1e14d8b147 (patch) | |
tree | bf5d5e30048d0ed44196d39850734031fb658c39 /convert.h | |
parent | 31b49d9b653803e7c7fd18b21c8bdd86e3421668 (diff) | |
download | git-jk/prompt-fallback-to-tty.tar.gz |
prompt: fall back to terminal if askpass failsjk/prompt-fallback-to-tty
The current askpass code simply dies if calling an askpass
helper fails. Worse, in some failure modes it doesn't even
print an error (if start_command fails, then it prints its
own error; if reading fails, we print an error; but if the
command exits non-zero, finish_command fails and we print
nothing!).
Let's be more kind to the user by printing an error message
when askpass doesn't work out, and then falling back to the
terminal (which also may fail, of course, but we die already
there with a nice message).
While we're at it, let's clean up the existing error
messages a bit. Now that our prompts are very long and
contain quotes and colons themselves, our error messages are
hard to read.
So the new failure modes look like:
[before, with a terminal]
$ GIT_ASKPASS=false git push
$ echo $?
128
[before, with no terminal, and we must give up]
$ setsid git push
fatal: could not read 'Password for 'https://peff@github.com': ': No such device or address
[after, with a terminal]
$ GIT_ASKPASS=false git push
error: unable to read askpass response from 'false'
Password for 'https://peff@github.com':
[after, with no terminal, and we must give up]
$ GIT_ASKPASS=false setsid git push
error: unable to read askpass response from 'false'
fatal: could not read Password for 'https://peff@github.com': No such device or address
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.h')
0 files changed, 0 insertions, 0 deletions