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.
This commit is contained in:
Linus Torvalds 2005-06-05 15:31:52 -07:00
parent f7b797073c
commit dc93841715
7 changed files with 14 additions and 12 deletions

View file

@ -437,6 +437,8 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch
{ "copy to ", gitdiff_copydst }, { "copy to ", gitdiff_copydst },
{ "rename old ", gitdiff_renamesrc }, { "rename old ", gitdiff_renamesrc },
{ "rename new ", gitdiff_renamedst }, { "rename new ", gitdiff_renamedst },
{ "rename from ", gitdiff_renamesrc },
{ "rename to ", gitdiff_renamedst },
{ "similarity index ", gitdiff_similarity }, { "similarity index ", gitdiff_similarity },
{ "dissimilarity index ", gitdiff_dissimilarity }, { "dissimilarity index ", gitdiff_dissimilarity },
{ "", gitdiff_unrecognized }, { "", gitdiff_unrecognized },

4
diff.c
View file

@ -786,8 +786,8 @@ static void diff_flush_patch(struct diff_filepair *p)
case 'R': case 'R':
sprintf(msg_, sprintf(msg_,
"similarity index %d%%\n" "similarity index %d%%\n"
"rename old %s\n" "rename from %s\n"
"rename new %s", "rename to %s",
(int)(0.5 + p->score * 100.0/MAX_SCORE), (int)(0.5 + p->score * 100.0/MAX_SCORE),
p->one->path, p->two->path); p->one->path, p->two->path);
msg = msg_; msg = msg_;

View file

@ -44,8 +44,8 @@ test_expect_success \
'git-diff-cache -p -M $tree >current' 'git-diff-cache -p -M $tree >current'
cat >expected <<\EOF cat >expected <<\EOF
diff --git a/path0 b/path1 diff --git a/path0 b/path1
rename old path0 rename from path0
rename new path1 rename to path1
--- a/path0 --- a/path0
+++ b/path1 +++ b/path1
@@ -8,7 +8,7 @@ Line 7 @@ -8,7 +8,7 @@ Line 7

View 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
+ 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 diff --git a/COPYING b/COPYING.2
rename old COPYING rename from COPYING
rename new COPYING.2 rename to COPYING.2
--- a/COPYING --- a/COPYING
+++ b/COPYING.2 +++ b/COPYING.2
@@ -2 +2 @@ @@ -2 +2 @@

View file

@ -48,8 +48,8 @@ copy from frotz
copy to nitfol copy to nitfol
diff --git a/frotz b/rezrov diff --git a/frotz b/rezrov
similarity index 100% similarity index 100%
rename old frotz rename from frotz
rename new rezrov rename to rezrov
diff --git a/yomin b/yomin diff --git a/yomin b/yomin
deleted file mode 100644 deleted file mode 100644
--- a/yomin --- a/yomin

View 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
+ 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 diff --git a/COPYING b/COPYING.2
rename old COPYING rename from COPYING
rename new COPYING.2 rename to COPYING.2
--- a/COPYING --- a/COPYING
+++ b/COPYING.2 +++ b/COPYING.2
@@ -2 +2 @@ @@ -2 +2 @@

View 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
+ 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 diff --git a/COPYING b/COPYING.2
rename old COPYING rename from COPYING
rename new COPYING.2 rename to COPYING.2
--- a/COPYING --- a/COPYING
+++ b/COPYING.2 +++ b/COPYING.2
@@ -2 +2 @@ @@ -2 +2 @@