Re: [PATCH] RFC: help.autocorrect prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> Any particular significance to INT_MAX rather than, e.g., -1 here?
> (Just curious; it seems unlikely someone would use INT_MAX and
> accidentally trip on this.)

> Not a problem introduced by your patch: should we be checking for
> out-of-range (e.g., negative) values?

The existing docs say that negative values correspond to immediate execution,
zero to never, and positive to a delay in deciseconds.

As noted, I chose INT_MAX as a rather unlikely conscious choice (~7 years).

> > @@ -342,7 +346,10 @@ const char *help_unknown_cmd(const char *cmd)
> >                       "which does not exist.\n"
> >                       "Continuing under the assumption that you meant 
'%s'\n",
> >                       cmd, assumed);
> > -             if (autocorrect > 0) {
> > +             if (autocorrect == INT_MAX) {
> > +                     if (strcmp("y", git_getpass("Continue? (y/n) ")))
> > +                             exit(1);
> 
> Funny. :)
> 
> It might be better to actually always write this prompt to the
> terminal, rather than popping up a gui $GIT_ASKPASS if the user has
> set that up.  Maybe something like Heiko Voigt's "mingw: make failures
> to unlike or move raise a question" (9229029, 2010-02-21 from
> 4msysgit.git):
> 
>         if (!isatty(STDIN_FILENO) || !isatty(STDERR_FILENO))
>                 exit(1);
>         fprintf(stderr, "Continue? (y/n) ");
>         if (!fgets(answer, sizeof(answer), stdin))
>                 exit(1)
>         if (*answer != 'y' && *answer != 'Y')
>                 exit(1);
> 
> > +             } else if (autocorrect > 0) {
> >                       fprintf(stderr, "in %0.1f seconds automatically...
\n",
> >                               (float)autocorrect/10.0);
> >                       poll(NULL, 0, autocorrect * 100);

That looks much nicer, I was hoping for such a suggestion.

--
David Barr.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]