Re: [PATCH v2 4/4] allow recovery from command name typos
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 26, 2012, 17:53 UTC
- Message-ID
- <7v394e8l4b.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CALUzUxp91zubHEkWMC1z2xp7kJCRYrtznQS_=pVSZoNkZMihig@mail.gmail.com>
Tay Ray Chuan <rctay89@gmail.com> writes:
Show 13 quoted lines
> On Thu, Jul 26, 2012 at 1:57 AM, Junio C Hamano <gitster@pobox.com> wrote: >> >> Tay Ray Chuan <rctay89@gmail.com> writes: >> >> > If suggestions are available (based on Levenshtein distance) and if the >> > terminal isatty(), present a prompt to the user to select one of the >> > computed suggestions. >> >> The way to determine "If the terminal is a tty" used in this patch >> looks overly dangerous, given that we do not know what kind of "git" >> command we may be invoking at this point. > > Indeed, it should also have considered stdin's tty-ness.
Not necessarily. As long as you call git_prompt(), which opens /dev/tty on its own and does not break even if its standard input is coming from elsewhere, you should be OK.