Skip to content

Commit

Permalink
Suppress non-zero exit codes for diff.
Browse files Browse the repository at this point in the history
Exactly as we do for `grep`.
  • Loading branch information
airblade committed Feb 26, 2014
1 parent 7e8d2fb commit aeec864
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions autoload/diff.vim
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ function! diff#run_diff(realtime, use_external_grep)
endif

if a:use_external_grep && s:grep_available
" grep exits with 1 when no matches are found. However we want to treat
" non-matches as non-erroneous behaviour; so we OR the command with one
let cmd .= s:grep_command
endif

if (a:use_external_grep && s:grep_available) || a:realtime
" grep exits with 1 when no matches are found; diff exits with 1 when
" differences are found. However we want to treat non-matches and
" differences as non-erroneous behaviour; so we OR the command with one
" which always returns true.
let cmd .= s:grep_command . ' || true'
let cmd.= ' || true'
endif

let cmd .= '))'
Expand Down

0 comments on commit aeec864

Please sign in to comment.