[Webkit-unassigned] [Bug 32834] svn-apply should handle git patches with similarity index, rename and copy directives

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 4 16:00:04 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=32834





--- Comment #9 from Chris Jerdonek <cjerdonek at webkit.org>  2010-05-04 16:00:03 PST ---
I was a bit surprised after comparing the behavior of the -C, -M, and
--find-copies-harder options of git-diff.

It seems that in some cases the --find-copies-harder option will do a worse
job of detecting renames than the -C and -M options (which are less
expensive at least for a smaller number of changed files).  See below, for
example (it's the last of the three scenarios where the difference can
be observed).

# Make a copy.
cp Makefile NMakefile
git add NMakefile
git commit -a

git diff --find-copies-harder HEAD^  # detects the copy
git diff -C HEAD^                    # does not detect the copy

# Turn the copy into a move.
rm Makefile
git commit -a --amend

git diff --find-copies-harder HEAD^  # detects the rename
git diff -C HEAD^                    # detects the rename

# Turn the move into a move-with-changes.
echo "more content" >> NMakefile 
git commit -a --amend

git diff --find-copies-harder HEAD^  # does not detect the rename
git diff -C HEAD^                    # does detect the rename (output is below)
git diff -M HEAD^                    # same result as -C
diff --git a/Makefile b/NMakefile
similarity index 99%
rename from Makefile
rename to NMakefile
index 1e50d1d..1459d21 100644
--- a/Makefile
+++ b/NMakefile
@@ -15,3 +15,4 @@ release r deployment dep deploy:
 clean:
        @for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
        if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
+test


>From the git-diff manual, this seems to be because --find-copies-hard
searches for potential sources by examining *only* those files that haven't
changed, and not both files that have and haven't changed.

Consequently, it may make sense in more cases to prefer using -C (or -M)
over --find-copies-harder.  This is in part because I imagine moves and
moves-with-changes are more common for contributors than straight copying
of files (without also deleting the source).

Also, based on the above, it looks like it might not be possible to
detect all copies and moves-with-changes for some diffs using a single
"git-diff" command.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list