Commit 9249f64c authored by mcgrathr@chromium.org's avatar mcgrathr@chromium.org

Pass --no-renames to git diff

If ~/.gitconfig contains:
	[diff]
		renames = "true"
then git diff --name-status will produce output that confuses the parsing
in svm.GIT.CaptureStatus and git diff will produce output that confuses the
patch command on trybots.  Passing --no-renames explicitly counteracts this.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@203778 0039d316-1c4b-4281-b951-d872f2087c98
parent bd1073eb
...@@ -113,7 +113,8 @@ class GIT(object): ...@@ -113,7 +113,8 @@ class GIT(object):
upstream_branch = GIT.GetUpstreamBranch(cwd) upstream_branch = GIT.GetUpstreamBranch(cwd)
if upstream_branch is None: if upstream_branch is None:
raise gclient_utils.Error('Cannot determine upstream branch') raise gclient_utils.Error('Cannot determine upstream branch')
command = ['diff', '--name-status', '-r', '%s...' % upstream_branch] command = ['diff', '--name-status', '--no-renames',
'-r', '%s...' % upstream_branch]
if not files: if not files:
pass pass
elif isinstance(files, basestring): elif isinstance(files, basestring):
...@@ -346,7 +347,9 @@ class GIT(object): ...@@ -346,7 +347,9 @@ class GIT(object):
branch = GIT.GetUpstreamBranch(cwd) branch = GIT.GetUpstreamBranch(cwd)
command = ['diff', '-p', '--no-color', '--no-prefix', '--no-ext-diff', command = ['diff', '-p', '--no-color', '--no-prefix', '--no-ext-diff',
branch + "..." + branch_head] branch + "..." + branch_head]
if not full_move: if full_move:
command.append('--no-renames')
else:
command.append('-C') command.append('-C')
# TODO(maruel): --binary support. # TODO(maruel): --binary support.
if files: if files:
......
...@@ -162,7 +162,7 @@ class TestGitCl(TestCase): ...@@ -162,7 +162,7 @@ class TestGitCl(TestCase):
] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [ ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''), ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
((['git', '--no-pager', 'rev-parse', 'HEAD'],), '12345'), ((['git', '--no-pager', 'rev-parse', 'HEAD'],), '12345'),
((['git', '--no-pager', 'diff', '--name-status', '-r', ((['git', '--no-pager', 'diff', '--name-status', '--no-renames', '-r',
'fake_ancestor_sha...', '.'],), 'fake_ancestor_sha...', '.'],),
'M\t.gitignore\n'), 'M\t.gitignore\n'),
((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''), ((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''),
...@@ -287,7 +287,7 @@ class TestGitCl(TestCase): ...@@ -287,7 +287,7 @@ class TestGitCl(TestCase):
((['git', '--no-pager', 'rev-parse', 'HEAD'],), ((['git', '--no-pager', 'rev-parse', 'HEAD'],),
'00ff397798ea57439712ed7e04ab96e13969ef40'), '00ff397798ea57439712ed7e04ab96e13969ef40'),
((['git', '--no-pager', ((['git', '--no-pager',
'diff', '--name-status', '-r', 'fake_ancestor_sha...', 'diff', '--name-status', '--no-renames', '-r', 'fake_ancestor_sha...',
'.'],), '.'],),
'M\tPRESUBMIT.py'), 'M\tPRESUBMIT.py'),
((['git', '--no-pager', ((['git', '--no-pager',
...@@ -533,7 +533,8 @@ class TestGitCl(TestCase): ...@@ -533,7 +533,8 @@ class TestGitCl(TestCase):
((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''), ((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
((['git', '--no-pager', 'rev-parse', 'HEAD'],), '12345'), ((['git', '--no-pager', 'rev-parse', 'HEAD'],), '12345'),
((['git', '--no-pager', ((['git', '--no-pager',
'diff', '--name-status', '-r', 'fake_ancestor_sha...', '.'],), 'diff', '--name-status', '--no-renames', '-r',
'fake_ancestor_sha...', '.'],),
'M\t.gitignore\n'), 'M\t.gitignore\n'),
((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''), ((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''),
((['git', '--no-pager', ((['git', '--no-pager',
......
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