From 744b639d690788bb46eda07d0e7978b319a38285 Mon Sep 17 00:00:00 2001 From: aweaver Date: Tue, 27 Sep 2022 12:26:26 +0200 Subject: [PATCH] Fix unwanted update during rebase Using a system cmd checking if a rebase is in progress to deny the update. Fix #10 --- plugin/stdheader.vim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugin/stdheader.vim b/plugin/stdheader.vim index da78555..dd0f02e 100644 --- a/plugin/stdheader.vim +++ b/plugin/stdheader.vim @@ -129,9 +129,13 @@ function! s:update() call s:filetype() if getline(9) =~ s:start . repeat(' ', s:margin - strlen(s:start)) . "Updated: " if &mod - call setline(9, s:line(9)) + if s:not_rebasing() + call setline(9, s:line(9)) + endif + endif + if s:not_rebasing() + call setline(4, s:line(4)) endif - call setline(4, s:line(4)) return 0 endif return 1 @@ -143,6 +147,13 @@ function! s:stdheader() endif endfunction +function! s:not_rebasing() + if system("ls `git rev-parse --git-dir 2>/dev/null` | grep rebase | wc -l") + return 0 + endif + return 1 +endfunction + " Bind command and shortcut command! Stdheader call s:stdheader () map :Stdheader