Skip to content

Commit

Permalink
diff 'rename' format change.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Linus Torvalds committed Jun 5, 2005
1 parent f7b7970 commit dc93841
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
4 changes: 2 additions & 2 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
4 changes: 2 additions & 2 deletions t/t4001-diff-rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions t/t4003-diff-rename-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down
4 changes: 2 additions & 2 deletions t/t4004-diff-rename-symlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions t/t4005-diff-rename-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down
4 changes: 2 additions & 2 deletions t/t4009-diff-rename-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down

0 comments on commit dc93841

Please sign in to comment.