Commit 3cdcf56c authored by zimmerle@gmail.com's avatar zimmerle@gmail.com

Ensures that local git config is used while checking if it is a Git-svn repo.

If no `--local` option is passed to git config command line tool, it will relies
on the local repository and then to the user configuration ($HOME/.gitconfig).
In case the user has - for some reason - a svn repository configured in this
user configuration, the checking: `git config --get-regexp ^svn-remote\.` will
accuse that there is svn repo and so the `git cl tool`. This patch just add
the option `--local` to the git config command line tool, avoiding this
situation.

R=maruel@chromium.org,dpranke@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/13884014

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@193987 0039d316-1c4b-4281-b951-d872f2087c98
parent 4a6cd04c
...@@ -278,7 +278,7 @@ class Settings(object): ...@@ -278,7 +278,7 @@ class Settings(object):
if self.is_git_svn is None: if self.is_git_svn is None:
# If you have any "svn-remote.*" config keys, we think you're using svn. # If you have any "svn-remote.*" config keys, we think you're using svn.
self.is_git_svn = RunGitWithCode( self.is_git_svn = RunGitWithCode(
['config', '--get-regexp', r'^svn-remote\.'])[0] == 0 ['config', '--local', '--get-regexp', r'^svn-remote\.'])[0] == 0
return self.is_git_svn return self.is_git_svn
def GetSVNBranch(self): def GetSVNBranch(self):
......
...@@ -171,7 +171,7 @@ class TestGitCl(TestCase): ...@@ -171,7 +171,7 @@ class TestGitCl(TestCase):
return [ return [
((['git', 'config', 'rietveld.cc'],), ''), ((['git', 'config', 'rietveld.cc'],), ''),
((['git', 'config', 'branch.master.base-url'],), ''), ((['git', 'config', 'branch.master.base-url'],), ''),
((['git', 'config', '--get-regexp', '^svn-remote\\.'],), ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
(('', None), 0)), (('', None), 0)),
((['git', 'rev-parse', '--show-cdup'],), ''), ((['git', 'rev-parse', '--show-cdup'],), ''),
((['git', 'svn', 'info'],), ''), ((['git', 'svn', 'info'],), ''),
...@@ -206,7 +206,7 @@ class TestGitCl(TestCase): ...@@ -206,7 +206,7 @@ class TestGitCl(TestCase):
@classmethod @classmethod
def _dcommit_calls_1(cls): def _dcommit_calls_1(cls):
return [ return [
((['git', 'config', '--get-regexp', '^svn-remote\\.'],), ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n'
'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'),
None), None),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment