Fix a FetchUpstreamTuple cwd bug

in_directory was not being set to the correct cwd. This caused commands to
always run in the dir from which gclient was executed.

Review URL: http://codereview.chromium.org/554142

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@37697 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
nasser@codeaurora.org 16 years ago
parent e42a1939f1
commit b65040abbf

@ -205,20 +205,16 @@ class GIT(object):
branch = GIT.GetBranch(cwd) branch = GIT.GetBranch(cwd)
upstream_branch = None upstream_branch = None
upstream_branch = GIT.Capture( upstream_branch = GIT.Capture(
['config', 'branch.%s.merge' % branch], error_ok=True)[0].strip() ['config', 'branch.%s.merge' % branch], in_directory=cwd,
error_ok=True)[0].strip()
if upstream_branch: if upstream_branch:
remote = GIT.Capture( remote = GIT.Capture(
['config', 'branch.%s.remote' % branch], ['config', 'branch.%s.remote' % branch],
error_ok=True)[0].strip() in_directory=cwd, error_ok=True)[0].strip()
else: else:
# Fall back on trying a git-svn upstream branch. # Fall back on trying a git-svn upstream branch.
if GIT.IsGitSvn(cwd): if GIT.IsGitSvn(cwd):
upstream_branch = GIT.GetSVNBranch(cwd) upstream_branch = GIT.GetSVNBranch(cwd)
# Fall back on origin/master if it exits.
if not upstream_branch:
GIT.Capture(['branch', '-r'])[0].split().count('origin/master')
remote = 'origin'
upstream_branch = 'refs/heads/master'
return remote, upstream_branch return remote, upstream_branch
@staticmethod @staticmethod

Loading…
Cancel
Save