Stop early when file is in .git directory.

This commit is contained in:
Andy Stewart
2015-03-23 11:36:34 +01:00
parent 1a7f1c5bf6
commit 8345c35770

View File

@@ -9,8 +9,14 @@ function! gitgutter#utility#warn(message)
let v:warningmsg = a:message let v:warningmsg = a:message
endfunction endfunction
" Returns truthy when the buffer's file should be processed; and falsey when it shouldn't.
" This function does not and should not make any system calls.
function! gitgutter#utility#is_active() function! gitgutter#utility#is_active()
return g:gitgutter_enabled && gitgutter#utility#exists_file() return g:gitgutter_enabled && gitgutter#utility#exists_file() && gitgutter#utility#not_git_dir()
endfunction
function! gitgutter#utility#not_git_dir()
return gitgutter#utility#full_path_to_directory_of_file() !~ '\.git\([/\\].*\)\?$'
endfunction endfunction
" A replacement for the built-in `shellescape(arg)`. " A replacement for the built-in `shellescape(arg)`.
@@ -51,6 +57,10 @@ function! gitgutter#utility#extension()
return fnamemodify(s:file, ':e') return fnamemodify(s:file, ':e')
endfunction endfunction
function! gitgutter#utility#full_path_to_directory_of_file()
return fnamemodify(s:file, ':p:h')
endfunction
function! gitgutter#utility#directory_of_file() function! gitgutter#utility#directory_of_file()
return fnamemodify(s:file, ':h') return fnamemodify(s:file, ':h')
endfunction endfunction