Skip to content

Commit dc93841

Browse files
author
Linus Torvalds
committed
diff 'rename' format change.
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.
1 parent f7b7970 commit dc93841

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

apply.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch
437437
{ "copy to ", gitdiff_copydst },
438438
{ "rename old ", gitdiff_renamesrc },
439439
{ "rename new ", gitdiff_renamedst },
440+
{ "rename from ", gitdiff_renamesrc },
441+
{ "rename to ", gitdiff_renamedst },
440442
{ "similarity index ", gitdiff_similarity },
441443
{ "dissimilarity index ", gitdiff_dissimilarity },
442444
{ "", gitdiff_unrecognized },

diff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,8 @@ static void diff_flush_patch(struct diff_filepair *p)
786786
case 'R':
787787
sprintf(msg_,
788788
"similarity index %d%%\n"
789-
"rename old %s\n"
790-
"rename new %s",
789+
"rename from %s\n"
790+
"rename to %s",
791791
(int)(0.5 + p->score * 100.0/MAX_SCORE),
792792
p->one->path, p->two->path);
793793
msg = msg_;

t/t4001-diff-rename.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ test_expect_success \
4444
'git-diff-cache -p -M $tree >current'
4545
cat >expected <<\EOF
4646
diff --git a/path0 b/path1
47-
rename old path0
48-
rename new path1
47+
rename from path0
48+
rename to path1
4949
--- a/path0
5050
+++ b/path1
5151
@@ -8,7 +8,7 @@ Line 7

t/t4003-diff-rename-1.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ copy to COPYING.1
4040
- HOWEVER, in order to allow a migration to GPLv3 if that seems like
4141
+ However, in order to allow a migration to GPLv3 if that seems like
4242
diff --git a/COPYING b/COPYING.2
43-
rename old COPYING
44-
rename new COPYING.2
43+
rename from COPYING
44+
rename to COPYING.2
4545
--- a/COPYING
4646
+++ b/COPYING.2
4747
@@ -2 +2 @@

t/t4004-diff-rename-symlink.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ copy from frotz
4848
copy to nitfol
4949
diff --git a/frotz b/rezrov
5050
similarity index 100%
51-
rename old frotz
52-
rename new rezrov
51+
rename from frotz
52+
rename to rezrov
5353
diff --git a/yomin b/yomin
5454
deleted file mode 100644
5555
--- a/yomin

t/t4005-diff-rename-2.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ copy to COPYING.1
5353
- HOWEVER, in order to allow a migration to GPLv3 if that seems like
5454
+ However, in order to allow a migration to GPLv3 if that seems like
5555
diff --git a/COPYING b/COPYING.2
56-
rename old COPYING
57-
rename new COPYING.2
56+
rename from COPYING
57+
rename to COPYING.2
5858
--- a/COPYING
5959
+++ b/COPYING.2
6060
@@ -2 +2 @@

t/t4009-diff-rename-4.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ copy to COPYING.1
5757
- HOWEVER, in order to allow a migration to GPLv3 if that seems like
5858
+ However, in order to allow a migration to GPLv3 if that seems like
5959
diff --git a/COPYING b/COPYING.2
60-
rename old COPYING
61-
rename new COPYING.2
60+
rename from COPYING
61+
rename to COPYING.2
6262
--- a/COPYING
6363
+++ b/COPYING.2
6464
@@ -2 +2 @@

0 commit comments

Comments
 (0)