Code

diff 'rename' format change.
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 5 Jun 2005 22:31:52 +0000 (15:31 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 5 Jun 2005 22:31:52 +0000 (15:31 -0700)
Clearly even Junio felt git "rename" header lines should say "from/to"
instead of "old/new", since he wrote the documentation that way.

This way it also matches "copy".

git-apply will accept both versions, at least for a while.

apply.c
diff.c
t/t4001-diff-rename.sh
t/t4003-diff-rename-1.sh
t/t4004-diff-rename-symlink.sh
t/t4005-diff-rename-2.sh
t/t4009-diff-rename-4.sh

diff --git a/apply.c b/apply.c
index ec63a0c1e0a68ebbd003ebe90776e12b42b081e7..1f48ef906fbf6c0f0a2efb6bf06599aa3081d30a 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -437,6 +437,8 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch
                        { "copy to ", gitdiff_copydst },
                        { "rename old ", gitdiff_renamesrc },
                        { "rename new ", gitdiff_renamedst },
+                       { "rename from ", gitdiff_renamesrc },
+                       { "rename to ", gitdiff_renamedst },
                        { "similarity index ", gitdiff_similarity },
                        { "dissimilarity index ", gitdiff_dissimilarity },
                        { "", gitdiff_unrecognized },
diff --git a/diff.c b/diff.c
index 2762905b56a6a247f661a12d1573f1877d29a959..046d9a39293fa5d33529b59a251f626785ced233 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -786,8 +786,8 @@ static void diff_flush_patch(struct diff_filepair *p)
        case 'R':
                sprintf(msg_,
                        "similarity index %d%%\n"
-                       "rename old %s\n"
-                       "rename new %s",
+                       "rename from %s\n"
+                       "rename to %s",
                        (int)(0.5 + p->score * 100.0/MAX_SCORE),
                        p->one->path, p->two->path);
                msg = msg_;
index 933a5bfc6be1b898e7017cf3dc8246506fdfa039..80edae6682bce319a754514602d7098b8c125b57 100755 (executable)
@@ -44,8 +44,8 @@ test_expect_success \
     'git-diff-cache -p -M $tree >current'
 cat >expected <<\EOF
 diff --git a/path0 b/path1
-rename old path0
-rename new path1
+rename from path0
+rename to path1
 --- a/path0
 +++ b/path1
 @@ -8,7 +8,7 @@ Line 7
index 7a5f73a3101cb7a5bb63dff6c2f00bcebcf12c2f..63a3103b4b372dd663249beb38d92592fb9a00af 100644 (file)
@@ -40,8 +40,8 @@ copy to COPYING.1
 - HOWEVER, in order to allow a migration to GPLv3 if that seems like
 + However, in order to allow a migration to GPLv3 if that seems like
 diff --git a/COPYING b/COPYING.2
-rename old COPYING
-rename new COPYING.2
+rename from COPYING
+rename to COPYING.2
 --- a/COPYING
 +++ b/COPYING.2
 @@ -2 +2 @@
index eb6dedd1caac8588542b133e980a6dc2f345c8a2..010dd87eef4ac0c2f2b3b5549bbb7147d4666fa4 100644 (file)
@@ -48,8 +48,8 @@ copy from frotz
 copy to nitfol
 diff --git a/frotz b/rezrov
 similarity index 100%
-rename old frotz
-rename new rezrov
+rename from frotz
+rename to rezrov
 diff --git a/yomin b/yomin
 deleted file mode 100644
 --- a/yomin
index fa2b1556b2ae2faa52a54db7b180aaa90baabe96..1921299fbcb55be26f299dade3ddc85b396e1db6 100644 (file)
@@ -53,8 +53,8 @@ copy to COPYING.1
 - HOWEVER, in order to allow a migration to GPLv3 if that seems like
 + However, in order to allow a migration to GPLv3 if that seems like
 diff --git a/COPYING b/COPYING.2
-rename old COPYING
-rename new COPYING.2
+rename from COPYING
+rename to COPYING.2
 --- a/COPYING
 +++ b/COPYING.2
 @@ -2 +2 @@
index 7d8ca6dc3580b6e72adb52232d208a86abe5332f..318915f4477b9ff6ad62c99718a841d0c2d046e2 100644 (file)
@@ -57,8 +57,8 @@ copy to COPYING.1
 - HOWEVER, in order to allow a migration to GPLv3 if that seems like
 + However, in order to allow a migration to GPLv3 if that seems like
 diff --git a/COPYING b/COPYING.2
-rename old COPYING
-rename new COPYING.2
+rename from COPYING
+rename to COPYING.2
 --- a/COPYING
 +++ b/COPYING.2
 @@ -2 +2 @@