<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tools/git-repo.git/tests/test_main.py, branch v2.69</title>
<subtitle>Mirror of gerrit.googlesource.com/git-repo</subtitle>
<id>https://git.enea.com/cgit/tools/git-repo.git/atom?h=v2.69</id>
<link rel='self' href='https://git.enea.com/cgit/tools/git-repo.git/atom?h=v2.69'/>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/'/>
<updated>2026-03-24T22:47:37+00:00</updated>
<entry>
<title>Implement command forgiveness with autocorrect</title>
<updated>2026-03-24T22:47:37+00:00</updated>
<author>
<name>Sam Saccone</name>
<email>samccone@google.com</email>
</author>
<published>2026-03-10T17:26:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=242e97d9ddf1a62fa3d9e92e21bd8b98b00e4455'/>
<id>urn:sha1:242e97d9ddf1a62fa3d9e92e21bd8b98b00e4455</id>
<content type='text'>
Similar to `git`, when a user types an unknown command like `repo tart`,
we now use `difflib.get_close_matches` to suggest similar commands.

If `help.autocorrect` is set in the git config, it will optionally
prompt the user to automatically run the assumed command, or wait
for a configured delay before executing it.

Verification Steps:
1. Created a dummy repo project locally.
2. Verified `help.autocorrect=0|false|off|no|show` suggests
   command and exits.
3. Verified `help.autocorrect=1|true|on|yes|immediate`
   automatically runs suggestion.
4. Verified `help.autocorrect=&lt;number&gt;` runs after
   `&lt;number&gt;*0.1` seconds.
5. Verified `help.autocorrect=never` exits immediately without
   suggestions.
6. Verified `help.autocorrect=prompt` asks user to accept [y/n]
   and handles correctly.

BUG: b/489753302

Change-Id: I6dcd63229cbd7badf5404459b48690c68f5b4857
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/558021
Tested-by: Sam Saccone &lt;samccone@google.com&gt;
Commit-Queue: Sam Saccone &lt;samccone@google.com&gt;
Reviewed-by: Mike Frysinger &lt;vapier@google.com&gt;
</content>
</entry>
</feed>
