git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: Do not hard-code "encoding" in attribute lookup functions
@ 2009-07-21  8:09 Johannes Sixt
  2009-08-13 11:52 ` Paul Mackerras
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Sixt @ 2009-07-21  8:09 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Git Mailing List

From: Johannes Sixt <j6t@kdbg.org>

Commit 39ee47e (Clean up file encoding code and add enable/disable option,
2008-10-15) rewrote the attribute lookup functions gitattr and
cache_gitattr, but in the process hard-coded the attribute name "encoding"
instead of using the functions' parameters. This fixes it.

This is not a serious regression because currently all callers look only
for "encoding".

Further note that this fix assumes that future callers will not pass an
attribute name that contains regex special characters.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 gitk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gitk b/gitk
index 4604c83..8aafb19 100755
--- a/gitk
+++ b/gitk
@@ -10901,7 +10901,7 @@ proc gitattr {path attr default} {
     } else {
 	set r "unspecified"
 	if {![catch {set line [exec git check-attr $attr -- $path]}]} {
-	    regexp "(.*): encoding: (.*)" $line m f r
+	    regexp "(.*): $attr: (.*)" $line m f r
 	}
 	set path_attr_cache($attr,$path) $r
     }
@@ -10929,7 +10929,7 @@ proc cache_gitattr {attr pathlist} {
 	set newlist [lrange $newlist $lim end]
 	if {![catch {set rlist [eval exec git check-attr $attr -- $head]}]} {
 	    foreach row [split $rlist "\n"] {
-		if {[regexp "(.*): encoding: (.*)" $row m path value]} {
+		if {[regexp "(.*): $attr: (.*)" $row m path value]} {
 		    if {[string index $path 0] eq "\""} {
 			set path [encoding convertfrom [lindex $path 0]]
 		    }
-- 
1.6.4.rc1.1032.g74cb

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gitk: Do not hard-code "encoding" in attribute lookup functions
  2009-07-21  8:09 [PATCH] gitk: Do not hard-code "encoding" in attribute lookup functions Johannes Sixt
@ 2009-08-13 11:52 ` Paul Mackerras
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mackerras @ 2009-08-13 11:52 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List

Johannes Sixt writes:

> Commit 39ee47e (Clean up file encoding code and add enable/disable option,
> 2008-10-15) rewrote the attribute lookup functions gitattr and
> cache_gitattr, but in the process hard-coded the attribute name "encoding"
> instead of using the functions' parameters. This fixes it.
> 
> This is not a serious regression because currently all callers look only
> for "encoding".
> 
> Further note that this fix assumes that future callers will not pass an
> attribute name that contains regex special characters.
> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>

Thanks, applied.

Paul.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-13 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-21  8:09 [PATCH] gitk: Do not hard-code "encoding" in attribute lookup functions Johannes Sixt
2009-08-13 11:52 ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).