Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t9003-help-autocorrect.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t9003-help-autocorrect.sh` 73 lines ยท 1634 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='help.autocorrect finding a match' 4 5 . ./test-lib.sh 6 7 test_expect_success 'setup' ' 8 # An alias 9 git config alias.lgf "log --format=%s --first-parent" && 10 11 # A random user-defined command 12 write_script git-distimdistim <<-EOF && 13 echo distimdistim was called 14 EOF 15 16 PATH="$PATH:." && 17 export PATH && 18 19 git commit --allow-empty -m "a single log entry" && 20 21 # Sanity check 22 git lgf >actual && 23 echo "a single log entry" >expect && 24 test_cmp expect actual && 25 26 git distimdistim >actual && 27 echo "distimdistim was called" >expect && 28 test_cmp expect actual 29 ' 30 31 for show in false no off 0 show 32 do 33 test_expect_success 'autocorrect showing candidates' ' 34 git config help.autocorrect $show && 35 36 test_must_fail git lfg 2>actual && 37 test_grep "^ lgf" actual && 38 39 test_must_fail git distimdist 2>actual && 40 test_grep "^ distimdistim" actual 41 ' 42 done 43 44 for immediate in -1 immediate 45 do 46 test_expect_success 'autocorrect running commands' ' 47 git config help.autocorrect $immediate && 48 49 git lfg >actual && 50 echo "a single log entry" >expect && 51 test_cmp expect actual && 52 53 git distimdist >actual && 54 echo "distimdistim was called" >expect && 55 test_cmp expect actual 56 ' 57 done 58 59 test_expect_success 'autocorrect can be declined altogether' ' 60 git config help.autocorrect never && 61 62 test_must_fail git lfg 2>actual && 63 test_grep "is not a git command" actual && 64 test_line_count = 1 actual 65 ' 66 67 test_expect_success 'autocorrect works in work tree created from bare repo' ' 68 git clone --bare . bare.git && 69 git -C bare.git worktree add ../worktree && 70 git -C worktree -c help.autocorrect=immediate status 71 ' 72 73 test_done