Skip to content

Commit

Permalink
Fix unwanted update during rebase
Browse files Browse the repository at this point in the history
Using a system cmd checking if a rebase is in progress to deny
the update.

Fix 42Paris#10
  • Loading branch information
AdrianWeaver committed Sep 27, 2022
1 parent 71e6a4d commit 744b639
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions plugin/stdheader.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <F1> :Stdheader<CR>
Expand Down

0 comments on commit 744b639

Please sign in to comment.