aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2022-10-27 06:57:40 -0400
committerGitHub <noreply@github.com>2022-10-27 06:57:40 -0400
commit5cf820f384f0c20a77f43da5aa49513739bd0c3d (patch)
treeed266bebc0aee8299b5575131f4d6c13c04196ac
parentdab07be4d14b3d4d94cbab2bdc29d3e6985e21f2 (diff)
parent9f6502535b8227a514a9225376d0db03484c803b (diff)
downloadrneovim-5cf820f384f0c20a77f43da5aa49513739bd0c3d.tar.gz
rneovim-5cf820f384f0c20a77f43da5aa49513739bd0c3d.tar.bz2
rneovim-5cf820f384f0c20a77f43da5aa49513739bd0c3d.zip
Merge pull request #20828 from zeertzjq/vim-patch-null
build(vim-patch.sh): handle added/removed files properly
-rwxr-xr-xscripts/vim-patch.sh9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index 0a2b1df197..c2fac658a9 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -315,12 +315,11 @@ uncrustify_patch() {
local before=$patch_path/before/$basename
local after=$patch_path/after/$basename
local patchfile="$patch_path"/patch/"$basename".patch
- if [[ ! -e $before ]] || [[ ! -e $after ]]; then
- continue
- fi
+ [[ ! -e $before ]] && before=/dev/null
+ [[ ! -e $after ]] && after=/dev/null
git --no-pager diff --no-index --patch --unified=5 --color=never "$before" "$after" > "$patchfile"
- sed -E "s|$before|/$file|g" -i "$patchfile"
- sed -E "s|$after|/$file|g" -i "$patchfile"
+ [[ "$before" != /dev/null ]] && sed -E "s|$before|/$file|g" -i "$patchfile"
+ [[ "$after" != /dev/null ]] && sed -E "s|$after|/$file|g" -i "$patchfile"
done
cat "$patch_path"/patch/*.patch