{"thread":{"id":"9555","subject":"[PATCH] gitk: Handle 'copy from' and 'copy to' in diff headers.","startedAt":"2007-08-16T12:32:29Z","lastAt":"2007-08-16T12:32:29Z","messageCount":1,"participants":["Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"50883","messageId":"11872675493132-git-send-email-johannes.sixt@telecom.at","threadId":"9555","inReplyTo":null,"subject":"[PATCH] gitk: Handle 'copy from' and 'copy to' in diff headers.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2007-08-16T12:32:29Z","receivedAt":"2007-08-16T12:32:29Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"If a commit contained a copy operation, the file name was not correctly\ndetermined, and the corresponding part of the patch could not be\nnavigated to from the list of files.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n gitk |   14 ++++++++------\n 1 files changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 57617d5..07b4a26 100755\n--- a/gitk\n+++ b/gitk\n@@ -5116,8 +5116,8 @@ proc getblobdiffline {bdf ids} {\n \t    # the middle char will be a space, and the two bits either\n \t    # side will be a/name and b/name, or \"a/name\" and \"b/name\".\n \t    # If the name has changed we'll get \"rename from\" and\n-\t    # \"rename to\" lines following this, and we'll use them\n-\t    # to get the filenames.\n+\t    # \"rename to\" or \"copy from\" and \"copy to\" lines following this,\n+\t    # and we'll use them to get the filenames.\n \t    # This complexity is necessary because spaces in the filename(s)\n \t    # don't get escaped.\n \t    set l [string length $line]\n@@ -5141,8 +5141,9 @@ proc getblobdiffline {bdf ids} {\n \t    set diffinhdr 0\n \n \t} elseif {$diffinhdr} {\n-\t    if {![string compare -length 12 \"rename from \" $line]} {\n-\t\tset fname [string range $line 12 end]\n+\t    if {![string compare -length 12 \"rename from \" $line] ||\n+\t\t![string compare -length 10 \"copy from \" $line]} {\n+\t\tset fname [string range $line [expr 6 + [string first \" from \" $line] ] end]\n \t\tif {[string index $fname 0] eq \"\\\"\"} {\n \t\t    set fname [lindex $fname 0]\n \t\t}\n@@ -5150,8 +5151,9 @@ proc getblobdiffline {bdf ids} {\n \t\tif {$i >= 0} {\n \t\t    setinlist difffilestart $i $curdiffstart\n \t\t}\n-\t    } elseif {![string compare -length 10 $line \"rename to \"]} {\n-\t\tset fname [string range $line 10 end]\n+\t    } elseif {![string compare -length 10 $line \"rename to \"] ||\n+\t\t      ![string compare -length 8 $line \"copy to \"]} {\n+\t\tset fname [string range $line [expr 4 + [string first \" to \" $line] ] end]\n \t\tif {[string index $fname 0] eq \"\\\"\"} {\n \t\t    set fname [lindex $fname 0]\n \t\t}\n-- \n1.5.3.rc5.15.g8ddb\n"}]}