# Suggestion for the "Did you mean this?" feature

14 messages from 2016-12-18 to 2017-06-21. Participants: Kaartic Sivaraam, Stephan Beyer, Alexei Lozovsky, Chris Packham, Marc Branchaud, Junio C Hamano.
Thread: https://gitlist.dev/t/44728

## Kaartic Sivaraam, 2016-12-18 12:18

Subject: Suggestion for the "Did you mean this?" feature
Message-ID: <1482063500.10858.1.camel@gmail.com>
URL: https://gitlist.dev/e/1482063500.10858.1.camel%40gmail.com

```
Hello all,

I have found the "Did you mean this?" feature of git as a very good
feature. I thought it would be even better if it took a step toward by
asking for a prompt when there was only one alternative to the command
that was entered. 

E.g.

> unique@unique-pc:~$ git hepl
> git: 'hepl' is not a git command. See 'git --help'.
> 
> Did you mean this?
> 	help
> [yes/No] : y
> usage: git [--version] [--help] [-C <path>] [-c name=value]
>            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-
> path]
> ....

This would make it even better for the user as it would avoid having to
correct the mistake long commands that had only a single error
(considering history feature is enabled). 

Is this is a good idea ?


-- 


Regards,
Kaartic

```

## Stephan Beyer, 2016-12-18 13:16

Subject: Re: Suggestion for the "Did you mean this?" feature
Message-ID: <5e1a3c4b-43b9-29f2-68fe-8149d9940123@gmx.net>
URL: https://gitlist.dev/e/5e1a3c4b-43b9-29f2-68fe-8149d9940123%40gmx.net
In-Reply-To: <1482063500.10858.1.camel@gmail.com>

```
Hi,

On 12/18/2016 01:18 PM, Kaartic Sivaraam wrote:
> I have found the "Did you mean this?" feature of git as a very good
> feature. I thought it would be even better if it took a step toward by
> asking for a prompt when there was only one alternative to the command
> that was entered. 
> 
> E.g.
> 
>> unique@unique-pc:~$ git hepl
>> git: 'hepl' is not a git command. See 'git --help'.
>>
>> Did you mean this?
>> 	help
>> [yes/No] : y
>> usage: git [--version] [--help] [-C <path>] [-c name=value]
>>            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-
>> path]
>> ....
> 
> This would make it even better for the user as it would avoid having to
> correct the mistake long commands that had only a single error
> (considering history feature is enabled). 
> 
> Is this is a good idea ?

I cannot tell if this is a good idea (or why it would be a bad idea) but
why do you restrict your suggestion to the case when there is only one
alternative?

Why not also something like:

---
$ git sta
git: 'sta' is not a git command. See 'git --help'.

Did you mean one of these?
	[1] status
	[2] stage
	[3] stash
You can choose or quit [1,2,3,q]:
---


Best
  Stephan

```

## Kaartic Sivaraam, 2016-12-18 13:26

Subject: Re: Suggestion for the "Did you mean this?" feature
Message-ID: <1482067588.13943.4.camel@gmail.com>
URL: https://gitlist.dev/e/1482067588.13943.4.camel%40gmail.com
In-Reply-To: <5e1a3c4b-43b9-29f2-68fe-8149d9940123@gmx.net>

```
On Sun, 2016-12-18 at 14:16 +0100, Stephan Beyer wrote:

> I cannot tell if this is a good idea (or why it would be a bad idea)
> but
> why do you restrict your suggestion to the case when there is only
> one
> alternative?
> 
> Why not also something like:
> 
> ---
> $ git sta
> git: 'sta' is not a git command. See 'git --help'.
> 
> Did you mean one of these?
> 	[1] status
> 	[2] stage
> 	[3] stash
> You can choose or quit [1,2,3,q]:

That would be fine too. Just thought it would be a good start to start
with a simple case. Also, I wasn't sure if there were any drawback's
that I was missing. I guess if it was implemented it wouldn't be
difficult to extend it further.

-- 


Regards,
Kaartic

```

## Alexei Lozovsky, 2016-12-18 15:16

Subject: Re: Suggestion for the "Did you mean this?" feature
Message-ID: <CALhvvbZSn2KVeEw5L14WQTNwo7ZhN1DY-MG31ogA1ppUMUJvVA@mail.gmail.com>
URL: https://gitlist.dev/e/CALhvvbZSn2KVeEw5L14WQTNwo7ZhN1DY-MG31ogA1ppUMUJvVA%40mail.gmail.com
In-Reply-To: <1482063500.10858.1.camel@gmail.com>

```
On 18 December 2016 at 14:18, Kaartic Sivaraam wrote:
> Hello all,
>
> I have found the "Did you mean this?" feature of git as a very good
> feature. I thought it would be even better if it took a step toward by
> asking for a prompt when there was only one alternative to the command
> that was entered.
>
> E.g.
>
>> unique@unique-pc:~$ git hepl
>> git: 'hepl' is not a git command. See 'git --help'.
>>
>> Did you mean this?
>>       help
>> [yes/No] : y
>> usage: git [--version] [--help] [-C <path>] [-c name=value]
>>            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-
>> path]
>> ....
>
> This would make it even better for the user as it would avoid having to
> correct the mistake long commands that had only a single error
> (considering history feature is enabled).
>
> Is this is a good idea ?

It's definitely a good thing for human users. For example, I am annoyed
from time to time when I type in some long spell, mistype one minor thing,
and the whole command fails. Then I need to press <up>, correct the
obvious typo, and run the command again.

Though, there is one aspect which may be the reason why git does not have
this feature: it requires interactive input. For example, it won't work
if some script tries to run an invalid git command. And git cannot really
tell whether it is running interactively or in a batch mode. If it is
running in batch mode then the whole script may hang indefinitely waiting
for nonexistent input. This also may apply to using git with pipes.

Maybe a configuration option or some GIT_NO_PROMPT environment variable
may be used to force disable this, but it still will be a hassle for the
scripts.

```

## Chris Packham, 2016-12-19 00:48

Subject: Re: Suggestion for the "Did you mean this?" feature
Message-ID: <CAFOYHZDnpzdYq9j4-xGSdKZQX9deLBpZZhz209qV7cCtq537SA@mail.gmail.com>
URL: https://gitlist.dev/e/CAFOYHZDnpzdYq9j4-xGSdKZQX9deLBpZZhz209qV7cCtq537SA%40mail.gmail.com
In-Reply-To: <1482063500.10858.1.camel@gmail.com>

```
On Mon, Dec 19, 2016 at 1:18 AM, Kaartic Sivaraam
<kaarticsivaraam91196@gmail.com> wrote:
> Hello all,
>
> I have found the "Did you mean this?" feature of git as a very good
> feature. I thought it would be even better if it took a step toward by
> asking for a prompt when there was only one alternative to the command
> that was entered.
>
> E.g.
>
>> unique@unique-pc:~$ git hepl
>> git: 'hepl' is not a git command. See 'git --help'.
>>
>> Did you mean this?
>>       help
>> [yes/No] : y
>> usage: git [--version] [--help] [-C <path>] [-c name=value]
>>            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-
>> path]
>> ....
>
> This would make it even better for the user as it would avoid having to
> correct the mistake long commands that had only a single error
> (considering history feature is enabled).
>
> Is this is a good idea ?

This feature already exists (although it's not interactive). See
help.autoCorrect in the git-config man page. "git config
help.autoCorrect -1" should to the trick.

```

## Marc Branchaud, 2016-12-19 17:01

Subject: [PATCH] Tweak help auto-correct phrasing.
Message-ID: <20161219170137.5507-1-marcnarc@xiplink.com>
URL: https://gitlist.dev/e/20161219170137.5507-1-marcnarc%40xiplink.com
In-Reply-To: <CAFOYHZDnpzdYq9j4-xGSdKZQX9deLBpZZhz209qV7cCtq537SA@mail.gmail.com>

```
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
---

On 2016-12-18 07:48 PM, Chris Packham wrote:
>
> This feature already exists (although it's not interactive). See
> help.autoCorrect in the git-config man page. "git config
> help.autoCorrect -1" should to the trick.

Awesome, I was unaware of this feature.  Thanks!

I found the message it prints a bit awkward, so here's a patch to fix it up.

Instead of:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'
   in 1.5 seconds automatically...

it's now:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing in 1.5 seconds under the assumption that you meant 'log'.

		M.

 help.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/help.c b/help.c
index 53e2a67e00..55350c0673 100644
--- a/help.c
+++ b/help.c
@@ -381,12 +381,18 @@ const char *help_unknown_cmd(const char *cmd)
 		clean_cmdnames(&main_cmds);
 		fprintf_ln(stderr,
 			   _("WARNING: You called a Git command named '%s', "
-			     "which does not exist.\n"
-			     "Continuing under the assumption that you meant '%s'"),
-			cmd, assumed);
-		if (autocorrect > 0) {
-			fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
-				(float)autocorrect/10.0);
+			     "which does not exist."),
+			   cmd);
+		if (autocorrect < 0)
+			fprintf_ln(stderr,
+				   _("Continuing under the assumption that "
+				     "you meant '%s'."),
+				   assumed);
+		else {
+			fprintf_ln(stderr,
+				   _("Continuing in %0.1f seconds under the "
+				     "assumption that you meant '%s'."),
+				   (float)autocorrect/10.0, assumed);
 			sleep_millisec(autocorrect * 100);
 		}
 		return assumed;
-- 
2.11.0.dirty


```

## Kaartic Sivaraam, 2016-12-19 19:24

Subject: Re: Suggestion for the "Did you mean this?" feature
Message-ID: <1482175466.2882.2.camel@gmail.com>
URL: https://gitlist.dev/e/1482175466.2882.2.camel%40gmail.com
In-Reply-To: <CAFOYHZDnpzdYq9j4-xGSdKZQX9deLBpZZhz209qV7cCtq537SA@mail.gmail.com>

```
Hello all,

On Sun, 18 December 2016 at 20:59, Alexei Lozovsky wrote,
> It's definitely a good thing for human users. For example, I am
> annoyed
> from time to time when I type in some long spell, mistype one minor
> thing,
> and the whole command fails. Then I need to press <up>, correct the
> obvious typo, and run the command again.
> 
> Though, there is one aspect which may be the reason why git does not
> have
> this feature: it requires interactive input. For example, it won't
> work
> if some script tries to run an invalid git command. And git cannot
> really
> tell whether it is running interactively or in a batch mode. If it is
> running in batch mode then the whole script may hang indefinitely
> waiting
> for nonexistent input. This also may apply to using git with pipes.
> 
> Maybe a configuration option or some GIT_NO_PROMPT environment
> variable
> may be used to force disable this, but it still will be a hassle for
> the
> scripts.

This is a good point that I didn't think of, sir. Thanks for bringing
it up. It seems that in some other form git does have the feature I was
suggesting.


On Mon, 2016-12-19 at 13:48 +1300, Chris Packham wrote:
> This feature already exists (although it's not interactive). See
> help.autoCorrect in the git-config man page. "git config
> help.autoCorrect -1" should to the trick.
Thanks for bringing this to notice, sir. I wasn't aware of it before.
It's in essence the same feature.


On Mon, 2016-12-19 at 12:01 -0500, Marc Branchaud wrote:
> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
> ---
> 
> Awesome, I was unaware of this feature.  Thanks!
> 
> I found the message it prints a bit awkward, so here's a patch to fix
> it up.
> 
> Instead of:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing under the assumption that you meant 'log'
>    in 1.5 seconds automatically...
> 
> it's now:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing in 1.5 seconds under the assumption that you meant
> 'log'.
Happy that my mail introduced a little change to git by revealing a not
often used feature.

-- 


Regards,
Kaartic

```

## Junio C Hamano, 2016-12-19 22:04

Subject: Re: [PATCH] Tweak help auto-correct phrasing.
Message-ID: <xmqqpoknmv7d.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqpoknmv7d.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20161219170137.5507-1-marcnarc@xiplink.com>

```
Marc Branchaud <marcnarc@xiplink.com> writes:

> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
> ---
>
> On 2016-12-18 07:48 PM, Chris Packham wrote:
>>
>> This feature already exists (although it's not interactive). See
>> help.autoCorrect in the git-config man page. "git config
>> help.autoCorrect -1" should to the trick.
>
> Awesome, I was unaware of this feature.  Thanks!
>
> I found the message it prints a bit awkward, so here's a patch to fix it up.
>
> Instead of:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing under the assumption that you meant 'log'
>    in 1.5 seconds automatically...
>
> it's now:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing in 1.5 seconds under the assumption that you meant 'log'.
>
> 		M.

Sounds better.

The "Instead of ... we now show ..." description deserves to be in
the log message, not after "---" line.

s/under the assumption/assuming/ would make it even shorter and give
the potentially long corrected command name a chance to still fit on
the line without wrapping, I would think, though.

>
>  help.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/help.c b/help.c
> index 53e2a67e00..55350c0673 100644
> --- a/help.c
> +++ b/help.c
> @@ -381,12 +381,18 @@ const char *help_unknown_cmd(const char *cmd)
>  		clean_cmdnames(&main_cmds);
>  		fprintf_ln(stderr,
>  			   _("WARNING: You called a Git command named '%s', "
> -			     "which does not exist.\n"
> -			     "Continuing under the assumption that you meant '%s'"),
> -			cmd, assumed);
> -		if (autocorrect > 0) {
> -			fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
> -				(float)autocorrect/10.0);
> +			     "which does not exist."),
> +			   cmd);
> +		if (autocorrect < 0)
> +			fprintf_ln(stderr,
> +				   _("Continuing under the assumption that "
> +				     "you meant '%s'."),
> +				   assumed);
> +		else {
> +			fprintf_ln(stderr,
> +				   _("Continuing in %0.1f seconds under the "
> +				     "assumption that you meant '%s'."),
> +				   (float)autocorrect/10.0, assumed);
>  			sleep_millisec(autocorrect * 100);
>  		}
>  		return assumed;

```

## Marc Branchaud, 2016-12-20 14:02

Subject: [PATCHv2] Tweak help auto-correct phrasing.
Message-ID: <20161220140226.18456-1-marcnarc@xiplink.com>
URL: https://gitlist.dev/e/20161220140226.18456-1-marcnarc%40xiplink.com
In-Reply-To: <xmqqpoknmv7d.fsf@gitster.mtv.corp.google.com>

```
When auto-correct is enabled, an invalid git command prints a warning and
a continuation message, which differs depending on whether or not
help.autoCorrect is positive or negative.

With help.autoCorrect = 15:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'
   in 1.5 seconds automatically...

With help.autoCorrect < 0:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'

The continuation message's phrasing is awkward.  This commit cleans it up.
As a bonus, we now use full-sentence strings which make translation easier.

With help.autoCorrect = 15:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing in 1.5 seconds, assuming that you meant 'log'.

With help.autoCorrect < 0:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
---

Writing the commit message was more work than the commit!  :)

		M.

 help.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/help.c b/help.c
index 53e2a67e00..fc56aa2d76 100644
--- a/help.c
+++ b/help.c
@@ -381,12 +381,18 @@ const char *help_unknown_cmd(const char *cmd)
 		clean_cmdnames(&main_cmds);
 		fprintf_ln(stderr,
 			   _("WARNING: You called a Git command named '%s', "
-			     "which does not exist.\n"
-			     "Continuing under the assumption that you meant '%s'"),
-			cmd, assumed);
-		if (autocorrect > 0) {
-			fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
-				(float)autocorrect/10.0);
+			     "which does not exist."),
+			   cmd);
+		if (autocorrect < 0)
+			fprintf_ln(stderr,
+				   _("Continuing under the assumption that "
+				     "you meant '%s'."),
+				   assumed);
+		else {
+			fprintf_ln(stderr,
+				   _("Continuing in %0.1f seconds, "
+				     "assuming that you meant '%s'."),
+				   (float)autocorrect/10.0, assumed);
 			sleep_millisec(autocorrect * 100);
 		}
 		return assumed;
-- 
2.11.0.1.g75fa99b


```

## Kaartic Sivaraam, 2017-06-20 18:04

Subject: Re: [PATCHv2] Tweak help auto-correct phrasing.
Message-ID: <1497981886.28187.6.camel@gmail.com>
URL: https://gitlist.dev/e/1497981886.28187.6.camel%40gmail.com
In-Reply-To: <20161220140226.18456-1-marcnarc@xiplink.com>

```
On Tue, 2016-12-20 at 09:02 -0500, Marc Branchaud wrote:
> When auto-correct is enabled, an invalid git command prints a warning
> and
> a continuation message, which differs depending on whether or not
> help.autoCorrect is positive or negative.
> 
> With help.autoCorrect = 15:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing under the assumption that you meant 'log'
>    in 1.5 seconds automatically...
> 
> With help.autoCorrect < 0:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing under the assumption that you meant 'log'
> 
> The continuation message's phrasing is awkward.  This commit cleans
> it up.
> As a bonus, we now use full-sentence strings which make translation
> easier.
> 
> With help.autoCorrect = 15:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing in 1.5 seconds, assuming that you meant 'log'.
> 
> With help.autoCorrect < 0:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing under the assumption that you meant 'log'.
> 
> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
> ---
> 
Excuse me for bringing this up after a long time. What's the status of
this patch? Was it applied?

-- 
Regards,
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>

```

## Marc Branchaud, 2017-06-20 18:21

Subject: Re: [PATCHv2] Tweak help auto-correct phrasing.
Message-ID: <3164ca01-9b54-3c9b-96d8-182c9fbbceb9@xiplink.com>
URL: https://gitlist.dev/e/3164ca01-9b54-3c9b-96d8-182c9fbbceb9%40xiplink.com
In-Reply-To: <1497981886.28187.6.camel@gmail.com>

```
On 2017-06-20 02:04 PM, Kaartic Sivaraam wrote:
> On Tue, 2016-12-20 at 09:02 -0500, Marc Branchaud wrote:
>> When auto-correct is enabled, an invalid git command prints a warning
>> and
>> a continuation message, which differs depending on whether or not
>> help.autoCorrect is positive or negative.
>>
>> With help.autoCorrect = 15:
>>
>>     WARNING: You called a Git command named 'lgo', which does not
>> exist.
>>     Continuing under the assumption that you meant 'log'
>>     in 1.5 seconds automatically...
>>
>> With help.autoCorrect < 0:
>>
>>     WARNING: You called a Git command named 'lgo', which does not
>> exist.
>>     Continuing under the assumption that you meant 'log'
>>
>> The continuation message's phrasing is awkward.  This commit cleans
>> it up.
>> As a bonus, we now use full-sentence strings which make translation
>> easier.
>>
>> With help.autoCorrect = 15:
>>
>>     WARNING: You called a Git command named 'lgo', which does not
>> exist.
>>     Continuing in 1.5 seconds, assuming that you meant 'log'.
>>
>> With help.autoCorrect < 0:
>>
>>     WARNING: You called a Git command named 'lgo', which does not
>> exist.
>>     Continuing under the assumption that you meant 'log'.
>>
>> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
>> ---
>>
> Excuse me for bringing this up after a long time. What's the status of
> this patch? Was it applied?

Looks like it got lost in the shuffle.

The topic thread starts at:
	http://public-inbox.org/git/1482063500.10858.1.camel@gmail.com/

There's no reply to my v2 patch, and I neglected to follow up on it -- 
sorry!

Shall I resend the patch?

		M.


```

## Kaartic Sivaraam, 2017-06-20 18:00

Subject: Re: [PATCHv2] Tweak help auto-correct phrasing.
Message-ID: <1497981610.28187.3.camel@gmail.com>
URL: https://gitlist.dev/e/1497981610.28187.3.camel%40gmail.com
In-Reply-To: <20161220140226.18456-1-marcnarc@xiplink.com>

```
On Tue, 2016-12-20 at 09:02 -0500, Marc Branchaud wrote:
> When auto-correct is enabled, an invalid git command prints a warning
> and
> a continuation message, which differs depending on whether or not
> help.autoCorrect is positive or negative.
> 
> With help.autoCorrect = 15:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing under the assumption that you meant 'log'
>    in 1.5 seconds automatically...
> 
> With help.autoCorrect < 0:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing under the assumption that you meant 'log'
> 
> The continuation message's phrasing is awkward.  This commit cleans
> it up.
> As a bonus, we now use full-sentence strings which make translation
> easier.
> 
> With help.autoCorrect = 15:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing in 1.5 seconds, assuming that you meant 'log'.
> 
> With help.autoCorrect < 0:
> 
>    WARNING: You called a Git command named 'lgo', which does not
> exist.
>    Continuing under the assumption that you meant 'log'.
> 
> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
> ---
> 
> Writing the commit message was more work than the commit!  :)
> 
> 		M.
> 
>  help.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/help.c b/help.c
> index 53e2a67e00..fc56aa2d76 100644
> --- a/help.c
> +++ b/help.c
> @@ -381,12 +381,18 @@ const char *help_unknown_cmd(const char *cmd)
>  		clean_cmdnames(&main_cmds);
>  		fprintf_ln(stderr,
>  			   _("WARNING: You called a Git command
> named '%s', "
> -			     "which does not exist.\n"
> -			     "Continuing under the assumption that
> you meant '%s'"),
> -			cmd, assumed);
> -		if (autocorrect > 0) {
> -			fprintf_ln(stderr, _("in %0.1f seconds
> automatically..."),
> -				(float)autocorrect/10.0);
> +			     "which does not exist."),
> +			   cmd);
> +		if (autocorrect < 0)
> +			fprintf_ln(stderr,
> +				   _("Continuing under the
> assumption that "
> +				     "you meant '%s'."),
> +				   assumed);
> +		else {
> +			fprintf_ln(stderr,
> +				   _("Continuing in %0.1f seconds, "
> +				     "assuming that you meant
> '%s'."),
> +				   (float)autocorrect/10.0,
> assumed);
>  			sleep_millisec(autocorrect * 100);
>  		}
>  		return assumed;
Excuse me bringing this up after a long time. Was this patch applied?
What's it's status?

-- 
Regards,
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>


```

## Marc Branchaud, 2017-06-21 13:57

Subject: [PATCHv2 (resend)] Tweak help auto-correct phrasing.
Message-ID: <20170621135738.27948-1-marcnarc@xiplink.com>
URL: https://gitlist.dev/e/20170621135738.27948-1-marcnarc%40xiplink.com
In-Reply-To: <3164ca01-9b54-3c9b-96d8-182c9fbbceb9@xiplink.com>

```
When auto-correct is enabled, an invalid git command prints a warning and
a continuation message, which differs depending on whether or not
help.autoCorrect is positive or negative.

With help.autoCorrect = 15:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'
   in 1.5 seconds automatically...

With help.autoCorrect < 0:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'

The continuation message's phrasing is awkward.  This commit cleans it up.
As a bonus, we now use full-sentence strings which make translation easier.

With help.autoCorrect = 15:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing in 1.5 seconds, assuming that you meant 'log'.

With help.autoCorrect < 0:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
---

So here's the patch again.

		M.

 help.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/help.c b/help.c
index f637fc800..69966c174 100644
--- a/help.c
+++ b/help.c
@@ -356,12 +356,18 @@ const char *help_unknown_cmd(const char *cmd)
 		clean_cmdnames(&main_cmds);
 		fprintf_ln(stderr,
 			   _("WARNING: You called a Git command named '%s', "
-			     "which does not exist.\n"
-			     "Continuing under the assumption that you meant '%s'"),
-			cmd, assumed);
-		if (autocorrect > 0) {
-			fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
-				(float)autocorrect/10.0);
+			     "which does not exist."),
+			   cmd);
+		if (autocorrect < 0)
+			fprintf_ln(stderr,
+				   _("Continuing under the assumption that "
+				     "you meant '%s'."),
+				   assumed);
+		else {
+			fprintf_ln(stderr,
+				   _("Continuing in %0.1f seconds, "
+				     "assuming that you meant '%s'."),
+				   (float)autocorrect/10.0, assumed);
 			sleep_millisec(autocorrect * 100);
 		}
 		return assumed;
-- 
2.13.1.388.g69e6b9b4f.dirty


```

## Junio C Hamano, 2017-06-21 22:34

Subject: Re: [PATCHv2 (resend)] Tweak help auto-correct phrasing.
Message-ID: <xmqqd19xm0m5.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqd19xm0m5.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20170621135738.27948-1-marcnarc@xiplink.com>

```
Marc Branchaud <marcnarc@xiplink.com> writes:

> When auto-correct is enabled, an invalid git command prints a warning and
> a continuation message, which differs depending on whether or not
> help.autoCorrect is positive or negative.
>
> With help.autoCorrect = 15:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing under the assumption that you meant 'log'
>    in 1.5 seconds automatically...
>
> With help.autoCorrect < 0:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing under the assumption that you meant 'log'
>
> The continuation message's phrasing is awkward.  This commit cleans it up.
> As a bonus, we now use full-sentence strings which make translation easier.
>
> With help.autoCorrect = 15:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing in 1.5 seconds, assuming that you meant 'log'.
>
> With help.autoCorrect < 0:
>
>    WARNING: You called a Git command named 'lgo', which does not exist.
>    Continuing under the assumption that you meant 'log'.
>
> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
> ---
>
> So here's the patch again.

Thanks.  Will queue and wait for people to yell at us when this
breaks their setup (which I highly doubt would happen ;-).

>  help.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/help.c b/help.c
> index f637fc800..69966c174 100644
> --- a/help.c
> +++ b/help.c
> @@ -356,12 +356,18 @@ const char *help_unknown_cmd(const char *cmd)
>  		clean_cmdnames(&main_cmds);
>  		fprintf_ln(stderr,
>  			   _("WARNING: You called a Git command named '%s', "
> -			     "which does not exist.\n"
> -			     "Continuing under the assumption that you meant '%s'"),
> -			cmd, assumed);
> -		if (autocorrect > 0) {
> -			fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
> -				(float)autocorrect/10.0);
> +			     "which does not exist."),
> +			   cmd);
> +		if (autocorrect < 0)
> +			fprintf_ln(stderr,
> +				   _("Continuing under the assumption that "
> +				     "you meant '%s'."),
> +				   assumed);
> +		else {
> +			fprintf_ln(stderr,
> +				   _("Continuing in %0.1f seconds, "
> +				     "assuming that you meant '%s'."),
> +				   (float)autocorrect/10.0, assumed);
>  			sleep_millisec(autocorrect * 100);
>  		}
>  		return assumed;

```
