mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch: Group alternations in preprocess_patch
Without the groupings, only the first alternation matches the diff marker. For example, local na_doc='todo\.txt\|version\d\.txt\|tags' ... +'g^diff --git a/runtime/doc/'${na_doc}'... becomes, after expansion, ... +'g^diff --git a/runtime/doc/todo\.txt\|version\d\.txt\|tags'... so the matches become "^diff --get a/runtime/doc/todo\.txt", "version\d\.txt", or "tags". Adding the grouping ensures the expected behavior of requiring "^diff --get a/runtime/doc/" before every filename.
This commit is contained in:
parent
e2ad3fbf27
commit
9d170a493e
@ -132,15 +132,15 @@ preprocess_patch() {
|
||||
# Remove *.proto, Make*, gui_*, some if_*
|
||||
local na_src='proto\|Make*\|gui_*'
|
||||
na_src="$na_src"'\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv'
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<'${na_src}'@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%('${na_src}'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||
|
||||
# Remove todo.txt, version*.txt, tags
|
||||
local na_doc='todo\.txt\|version\d\.txt\|tags'
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/'${na_doc}'@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\%('${na_doc}'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||
|
||||
# Remove some testdir/Make_*.mak files
|
||||
local na_src_testdir='Make_amiga.mak\|Make_dos.mak\|Make_ming.mak\|Make_vms.mms'
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/'${na_src_testdir}'@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\%('${na_src_testdir}'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||
|
||||
# Rename src/ paths to src/nvim/
|
||||
LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g' "$file" > "$file".tmp && mv "$file".tmp "$file"
|
||||
|
Loading…
Reference in New Issue
Block a user