@@ -108,6 +108,7 @@ endfunction
108
108
" * non-empty string - path
109
109
" * -1 - pending
110
110
" * -2 - not tracked by git
111
+ " * -3 - assume unchanged
111
112
function ! gitgutter#utility#repo_path (bufnr , shellesc) abort
112
113
let p = gitgutter#utility#getbufvar (a: bufnr , ' path' , ' ' )
113
114
return a: shellesc ? gitgutter#utility#shellescape (p ) : p
@@ -116,9 +117,13 @@ endfunction
116
117
117
118
let s: set_path_handler = {}
118
119
119
- function ! s: set_path_handler .out (buffer , path ) abort
120
- let path = s: strip_trailing_new_line (a: path )
121
- call gitgutter#utility#setbufvar (a: buffer , ' path' , path )
120
+ function ! s: set_path_handler .out (buffer , listing) abort
121
+ let [status, path ] = split (s: strip_trailing_new_line (a: listing ))
122
+ if status = ~ ' [[:lower:]]'
123
+ call gitgutter#utility#setbufvar (a: buffer , ' path' , -3 )
124
+ else
125
+ call gitgutter#utility#setbufvar (a: buffer , ' path' , path )
126
+ endif
122
127
123
128
if type (self .continuation) == type (function (' tr' ))
124
129
call self .continuation ()
@@ -140,9 +145,10 @@ function! gitgutter#utility#set_repo_path(bufnr, continuation) abort
140
145
" * non-empty string - path
141
146
" * -1 - pending
142
147
" * -2 - not tracked by git
148
+ " * -3 - assume unchanged
143
149
144
150
call gitgutter#utility#setbufvar (a: bufnr , ' path' , -1 )
145
- let cmd = gitgutter#utility#cd_cmd (a: bufnr , g: gitgutter_git_executable .' ' .g: gitgutter_git_args .' ls-files --error-unmatch --full-name -z -- ' .gitgutter#utility#shellescape (s: filename (a: bufnr )))
151
+ let cmd = gitgutter#utility#cd_cmd (a: bufnr , g: gitgutter_git_executable .' ' .g: gitgutter_git_args .' ls-files -v - -error-unmatch --full-name -z -- ' .gitgutter#utility#shellescape (s: filename (a: bufnr )))
146
152
147
153
if g: gitgutter_async && gitgutter#async#available () && ! has (' vim_starting' )
148
154
let handler = copy (s: set_path_handler )
@@ -151,11 +157,18 @@ function! gitgutter#utility#set_repo_path(bufnr, continuation) abort
151
157
return ' async'
152
158
endif
153
159
154
- let path = gitgutter#utility#system (cmd)
160
+ let listing = gitgutter#utility#system (cmd)
161
+
155
162
if v: shell_error
156
163
call gitgutter#utility#setbufvar (a: bufnr , ' path' , -2 )
164
+ return
165
+ endif
166
+
167
+ let [status, path ] = split (s: strip_trailing_new_line (listing))
168
+ if status = ~ ' [[:lower:]]'
169
+ call gitgutter#utility#setbufvar (a: bufnr , ' path' , -3 )
157
170
else
158
- call gitgutter#utility#setbufvar (a: bufnr , ' path' , s: strip_trailing_new_line ( path ) )
171
+ call gitgutter#utility#setbufvar (a: bufnr , ' path' , path )
159
172
endif
160
173
endfunction
161
174
0 commit comments