aboutsummaryrefslogtreecommitdiff
path: root/scripts/vim-patch.sh
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-27 13:38:47 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-10-27 13:59:57 +0800
commit9f6502535b8227a514a9225376d0db03484c803b (patch)
treeff3df72f99980163f8e8f69858b7c7f22962c8e3 /scripts/vim-patch.sh
parentc41873ab638589c1052404f5e5abef98a61db073 (diff)
downloadrneovim-9f6502535b8227a514a9225376d0db03484c803b.tar.gz
rneovim-9f6502535b8227a514a9225376d0db03484c803b.tar.bz2
rneovim-9f6502535b8227a514a9225376d0db03484c803b.zip
build(vim-patch.sh): handle added/removed files properly
Diffstat (limited to 'scripts/vim-patch.sh')
-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