bugGNU patch - Bugs: bug #44227, git patches will rename the wrong...

 
 

bug #44227: git patches will rename the wrong way

Submitted by:  Guido Draheim <guidod>
Submitted on:  Wed 11 Feb 2015 09:13:27 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 22 Feb 2015 05:52:30 PM UTC, comment #2:

Thanks for the bug report. Fixed in commit db9f3950.

Andreas Gruenbacher <agruen>
Project Administrator
Wed 11 Feb 2015 09:45:21 AM UTC, comment #1:

patch --version
GNU patch 2.7.3

openSUSE 13.1

rpm -q patch
patch-2.7.3-4.4.1.x86_64

Guido Draheim <guidod>
Wed 11 Feb 2015 09:13:27 AM UTC, original submission:

If the git-patch contains the information of a rename from file1.cpp to file2.cpp ... but the target area only contains file2.cpp then gnu-patch will rename file2.cpp to file1.cpp

This was observed with a mercurial diff export.
Used the supplied script to reproduce the problem,
when executing then this is the result:

+ echo '// file1'
+ hg add file1.cpp
+ hg ci -m created
+ hg rename file1.cpp file2.cpp
+ echo '// file2'
+ hg ci -m renamed
+ : ===============================
+ hg diff --git -c 1
+ cat change1.patch
diff --git a/file1.cpp b/file2.cpp
rename from file1.cpp
rename to file2.cpp
--- a/file1.cpp
+++ b/file2.cpp
@@ -1,1 +1,1 @@
-// file1
+// file2
+ : ===============================
+ echo '// file1'
+ patch -p1
patching file file1.cpp (renamed from file2.cpp)

and the patch has succeeded. Although the change1.patch target is a file2.cpp the resulting directory has a file1.cpp.

Guido Draheim <guidod>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #33051:  patch-problem.sh added by guidod (390B - application/x-shellscript)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by agruen (Posted a comment)
  • -unavailable- added by guidod (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 22 Feb 2015 05:52:30 PM UTCagruenStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Wed 11 Feb 2015 09:13:27 AM UTCguidodAttached File-=>Added patch-problem.sh, #33051

    Back to the top


    Powered by Savane 3.1-cleanup1