From 3cdcf56c584eebd20d798045b923b89b29436def Mon Sep 17 00:00:00 2001 From: "zimmerle@gmail.com" Date: Fri, 12 Apr 2013 19:39:38 +0000 Subject: [PATCH] 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 --- git_cl.py | 2 +- tests/git_cl_test.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/git_cl.py b/git_cl.py index aa19d29cb8..a186029f18 100755 --- a/git_cl.py +++ b/git_cl.py @@ -278,7 +278,7 @@ class Settings(object): if self.is_git_svn is None: # If you have any "svn-remote.*" config keys, we think you're using svn. 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 def GetSVNBranch(self): diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 58508bf452..a890dac4f3 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -171,7 +171,7 @@ class TestGitCl(TestCase): return [ ((['git', 'config', 'rietveld.cc'],), ''), ((['git', 'config', 'branch.master.base-url'],), ''), - ((['git', 'config', '--get-regexp', '^svn-remote\\.'],), + ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],), (('', None), 0)), ((['git', 'rev-parse', '--show-cdup'],), ''), ((['git', 'svn', 'info'],), ''), @@ -206,7 +206,7 @@ class TestGitCl(TestCase): @classmethod def _dcommit_calls_1(cls): 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.fetch trunk/src:refs/remotes/origin/master'), None),