Turn on git diff copy detection for git-cl upload.
Enable copy detection for git-cl upload. This makes
it possible to copy a directory containing many files,
add+commit the new path, and then upload a patch to
Rietveld that shows the files were copied.
In my tests, -C -C was needed to pick up a basic
file copy. -C was not enough. I'm not sure why
exactly. The output generated in the diff looks
like:
sh$ git diff -C -C HEAD~1..HEAD
diff --git a/slave/Makefile b/slave2/Makefile
similarity index 100%
copy from slave/Makefile
copy to slave2/Makefile
...
Review URL: https://chromiumcodereview.appspot.com/10412027
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@140314 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index e0705fa..c3fdb07 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -114,7 +114,7 @@
((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'),
((['git', 'config', 'user.email'],), 'me@example.com'),
- ((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],),
+ ((['git', 'diff', '--no-ext-diff', '--stat', '-C', '-C', 'master...'],),
'+dat'),
((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],), 'desc\n'),
]
@@ -217,7 +217,7 @@
'--message', description
] + args + [
'--cc', 'joe@example.com',
- 'master...'
+ 'master...', '--', '-C',
]
def _run_reviewer_test(
@@ -347,7 +347,7 @@
((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'),
((['git', 'config', 'user.email'],), 'me@example.com'),
- ((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],),
+ ((['git', 'diff', '--no-ext-diff', '--stat', '-C', '-C', 'master...'],),
'+dat'),
]