Skip to content

Unset GIT_CONFIG during git config #858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plug.vim
Original file line number Diff line number Diff line change
@@ -1625,7 +1625,7 @@ class Plugin(object):
self.write(Action.DONE, self.name, result[-1:])

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'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the unset be done before the first git rev-parse, I wonder? Could an errant GIT_CONFIG somehow change how --abbrev-ref determines the branch name?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re my comment, if that's the case, note that that would be an existing bug rather than a problem introduced by this PR. I think this PR could be merged as is.

command = Command(cmd, self.args['dir'], G_TIMEOUT,)
result = command.execute(G_RETRIES)
return result[-1]
@@ -1939,7 +1939,7 @@ function! s:update_ruby()
ok, result =
if exists
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
if !ret
if data =~ /^Interrupted|^Timeout/
@@ -2054,7 +2054,7 @@ endfunction
function! s:git_validate(spec, check_branch)
let err = ''
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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to work on all OS?

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]
if v:shell_error
let err = join([remote, 'PlugClean required.'], "\n")