On Sat, Mar 06, 2010 at 12:40:13PM -0600, Jonathan Nieder wrote:
> > (I'd gladly submit a patch if I could, but uncommented Tcl code...
> > <shudder>)
> 
> If it were spread out over multiple files, it would not be so bad. ;-)

I beg to differ.  :)

(In particular, the amount of repeated code would probably give a Ruby
programmer seizures.)

> The function to look for is askfindhighlight.

That's only one half; the other is in findmore.

Anyway, I tried matching against the formatted date string, but
converting on the fly was unbearably slow.  OTOH, I didn't dare store
the string instead of the timestamp, for fear it would confuse newvarc
or citool.  (Besides, bolden_name mystifies me, yet it would need to be
duplicated as bolden_date.)

So, I did the cowardly thing: I ripped the whole thing off.  Hey, it
works.  :)


-- 
How do you power off this machine?
        -- Linus, when upgrading linux.cs.helsinki.fi, and after using the
           machine for several months
>From 9dfdb1d58e4851fa56b76d864387ab778405ec29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= <fbri...@fbriere.net>
Date: Sun, 14 Mar 2010 16:26:27 -0400
Subject: [PATCH] gitk: Skip over AUTHOR/COMMIT_DATE when searching all fields

This prevents searches on "All Fields" from matching against the
author/commit timestamps.  Not only are these timestamps not searchable
by themselves, but the displayed format will not match the query string
anyway.
---
 gitk-git/gitk |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 1f36a3e..d7e3c45 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -4591,8 +4591,9 @@ proc askfindhighlight {row id} {
     }
     set info $commitinfo($id)
     set isbold 0
-    set fldtypes [list [mc Headline] [mc Author] [mc Date] [mc Committer] [mc CDate] [mc Comments]]
+    set fldtypes [list [mc Headline] [mc Author] "" [mc Committer] "" [mc Comments]]
     foreach f $info ty $fldtypes {
+	if {$ty eq ""} continue
 	if {($findloc eq [mc "All fields"] || $findloc eq $ty) &&
 	    [doesmatch $f]} {
 	    if {$ty eq [mc "Author"]} {
@@ -6438,7 +6439,7 @@ proc findmore {} {
     if {![info exists find_dirn]} {
 	return 0
     }
-    set fldtypes [list [mc "Headline"] [mc "Author"] [mc "Date"] [mc "Committer"] [mc "CDate"] [mc "Comments"]]
+    set fldtypes [list [mc "Headline"] [mc "Author"] "" [mc "Committer"] "" [mc "Comments"]]
     set l $findcurline
     set moretodo 0
     if {$find_dirn > 0} {
@@ -6499,6 +6500,7 @@ proc findmore {} {
 	    }
 	    set info $commitinfo($id)
 	    foreach f $info ty $fldtypes {
+		if {$ty eq ""} continue
 		if {($findloc eq [mc "All fields"] || $findloc eq $ty) &&
 		    [doesmatch $f]} {
 		    set found 1
-- 
1.7.0

Reply via email to