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
experimental/szager/collated-output
mcgrathr@chromium.org 12 years ago
parent bd1073ebe6
commit 9249f64cf4

@ -113,7 +113,8 @@ class GIT(object):
upstream_branch = GIT.GetUpstreamBranch(cwd)
if upstream_branch is None:
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:
pass
elif isinstance(files, basestring):
@ -346,7 +347,9 @@ class GIT(object):
branch = GIT.GetUpstreamBranch(cwd)
command = ['diff', '-p', '--no-color', '--no-prefix', '--no-ext-diff',
branch + "..." + branch_head]
if not full_move:
if full_move:
command.append('--no-renames')
else:
command.append('-C')
# TODO(maruel): --binary support.
if files:

@ -162,7 +162,7 @@ class TestGitCl(TestCase):
] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
((['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...', '.'],),
'M\t.gitignore\n'),
((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''),
@ -287,7 +287,7 @@ class TestGitCl(TestCase):
((['git', '--no-pager', 'rev-parse', 'HEAD'],),
'00ff397798ea57439712ed7e04ab96e13969ef40'),
((['git', '--no-pager',
'diff', '--name-status', '-r', 'fake_ancestor_sha...',
'diff', '--name-status', '--no-renames', '-r', 'fake_ancestor_sha...',
'.'],),
'M\tPRESUBMIT.py'),
((['git', '--no-pager',
@ -533,7 +533,8 @@ class TestGitCl(TestCase):
((['git', '--no-pager', 'rev-parse', '--show-cdup'],), ''),
((['git', '--no-pager', 'rev-parse', 'HEAD'],), '12345'),
((['git', '--no-pager',
'diff', '--name-status', '-r', 'fake_ancestor_sha...', '.'],),
'diff', '--name-status', '--no-renames', '-r',
'fake_ancestor_sha...', '.'],),
'M\t.gitignore\n'),
((['git', '--no-pager', 'config', 'branch.master.rietveldissue'],), ''),
((['git', '--no-pager',

Loading…
Cancel
Save