{"thread":{"id":"20172","subject":"[PATCH] gitk: Do not hard-code \"encoding\" in attribute lookup functions","startedAt":"2009-07-21T08:09:48Z","lastAt":"2009-08-13T11:52:13Z","messageCount":2,"participants":["Johannes Sixt","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"118360","messageId":"4A6577CC.2000403@viscovery.net","threadId":"20172","inReplyTo":null,"subject":"[PATCH] gitk: Do not hard-code \"encoding\" in attribute lookup functions","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-07-21T08:09:48Z","receivedAt":"2009-07-21T08:09:48Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nCommit 39ee47e (Clean up file encoding code and add enable/disable option,\n2008-10-15) rewrote the attribute lookup functions gitattr and\ncache_gitattr, but in the process hard-coded the attribute name \"encoding\"\ninstead of using the functions' parameters. This fixes it.\n\nThis is not a serious regression because currently all callers look only\nfor \"encoding\".\n\nFurther note that this fix assumes that future callers will not pass an\nattribute name that contains regex special characters.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n gitk |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 4604c83..8aafb19 100755\n--- a/gitk\n+++ b/gitk\n@@ -10901,7 +10901,7 @@ proc gitattr {path attr default} {\n     } else {\n \tset r \"unspecified\"\n \tif {![catch {set line [exec git check-attr $attr -- $path]}]} {\n-\t    regexp \"(.*): encoding: (.*)\" $line m f r\n+\t    regexp \"(.*): $attr: (.*)\" $line m f r\n \t}\n \tset path_attr_cache($attr,$path) $r\n     }\n@@ -10929,7 +10929,7 @@ proc cache_gitattr {attr pathlist} {\n \tset newlist [lrange $newlist $lim end]\n \tif {![catch {set rlist [eval exec git check-attr $attr -- $head]}]} {\n \t    foreach row [split $rlist \"\\n\"] {\n-\t\tif {[regexp \"(.*): encoding: (.*)\" $row m path value]} {\n+\t\tif {[regexp \"(.*): $attr: (.*)\" $row m path value]} {\n \t\t    if {[string index $path 0] eq \"\\\"\"} {\n \t\t\tset path [encoding convertfrom [lindex $path 0]]\n \t\t    }\n-- \n1.6.4.rc1.1032.g74cb\n"},{"id":"120511","messageId":"19075.65133.297090.208203@cargo.ozlabs.ibm.com","threadId":"20172","inReplyTo":"4A6577CC.2000403@viscovery.net","subject":"Re: [PATCH] gitk: Do not hard-code \"encoding\" in attribute lookup functions","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2009-08-13T11:52:13Z","receivedAt":"2009-08-13T11:52:13Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Johannes Sixt writes:\n\n> Commit 39ee47e (Clean up file encoding code and add enable/disable option,\n> 2008-10-15) rewrote the attribute lookup functions gitattr and\n> cache_gitattr, but in the process hard-coded the attribute name \"encoding\"\n> instead of using the functions' parameters. This fixes it.\n> \n> This is not a serious regression because currently all callers look only\n> for \"encoding\".\n> \n> Further note that this fix assumes that future callers will not pass an\n> attribute name that contains regex special characters.\n> \n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n\nThanks, applied.\n\nPaul.\n"}]}