git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Paul Mackerras <paulus@samba.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] gitk: Do not hard-code "encoding" in attribute lookup functions
Date: Tue, 21 Jul 2009 10:09:48 +0200	[thread overview]
Message-ID: <4A6577CC.2000403@viscovery.net> (raw)

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

             reply	other threads:[~2009-07-21  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  8:09 Johannes Sixt [this message]
2009-08-13 11:52 ` [PATCH] gitk: Do not hard-code "encoding" in attribute lookup functions Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A6577CC.2000403@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).