Community
Participate
Working Groups
C Git and JGit differ about how a patch should appear when renaming a file and also creating a symlink at the old name location. $ git diff -M HEAD^ HEAD diff --git a/a b/a deleted file mode 100644 index ce01362..0000000 --- a/a +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/a b/a new file mode 120000 index 0000000..63d8dbd --- /dev/null +++ b/a @@ -0,0 +1 @@ +b \ No newline at end of file diff --git a/b b/b new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/b @@ -0,0 +1 @@ +hello JGit correctly identifies the rename, but fails because the rename occurs after the symlink creation. The rename needs to come first to ensure the old name is available for the symlink to create under: $ ../jgit/jgit diff -M HEAD^ HEAD diff --git a/a b/a new file mode 120000 index 0000000..63d8dbd --- /dev/null +++ b/a @@ -0,0 +1 @@ +b \ No newline at end of file diff --git a/a b/b similarity index 100% rename from a rename to b
Spoke to Junio C Hamano about this, turns out the patch order is fine. git apply applies patches relative to the old tree, so actual order between files within a patch is irrelevant. This permits concatenating two patches together, because that's what Linus Torvalds wanted to be able to do.