Remove -f .git/config from git config

Plugins fail to update when managed with `git submodule`. Unset
`GIT_CONFIG` so that `git` take the configuration in default behavior.

Close #455
Close #470
Close #834
This commit is contained in:
Tian Yuanhao 2019-07-14 13:10:18 +08:00
parent 226d6abeb2
commit cf088349f1

View File

@ -1625,7 +1625,7 @@ class Plugin(object):
self.write(Action.DONE, self.name, result[-1:]) self.write(Action.DONE, self.name, result[-1:])
def repo_uri(self): def repo_uri(self):
cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && unset GIT_CONFIG && git config remote.origin.url'
command = Command(cmd, self.args['dir'], G_TIMEOUT,) command = Command(cmd, self.args['dir'], G_TIMEOUT,)
result = command.execute(G_RETRIES) result = command.execute(G_RETRIES)
return result[-1] return result[-1]
@ -1939,7 +1939,7 @@ function! s:update_ruby()
ok, result = ok, result =
if exists if exists
chdir = "#{cd} #{iswin ? dir : esc(dir)}" chdir = "#{cd} #{iswin ? dir : esc(dir)}"
ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && unset GIT_CONFIG && git config remote.origin.url", nil, nil, nil
current_uri = data.lines.to_a.last current_uri = data.lines.to_a.last
if !ret if !ret
if data =~ /^Interrupted|^Timeout/ if data =~ /^Interrupted|^Timeout/
@ -2054,7 +2054,7 @@ endfunction
function! s:git_validate(spec, check_branch) function! s:git_validate(spec, check_branch)
let err = '' let err = ''
if isdirectory(a:spec.dir) if isdirectory(a:spec.dir)
let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir)) let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && unset GIT_CONFIG && git config remote.origin.url', a:spec.dir))
let remote = result[-1] let remote = result[-1]
if v:shell_error if v:shell_error
let err = join([remote, 'PlugClean required.'], "\n") let err = join([remote, 'PlugClean required.'], "\n")