From: Junio C Hamano Date: Thu, 26 Jul 2012 17:53:24 GMT Subject: Re: [PATCH v2 4/4] allow recovery from command name typos Message-ID: <7v394e8l4b.fsf@alter.siamese.dyndns.org> In-Reply-To: Tay Ray Chuan writes: > On Thu, Jul 26, 2012 at 1:57 AM, Junio C Hamano wrote: >> >> Tay Ray Chuan 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.