git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Getting pickaxe to perform looser matches, or regex matching

From
Martin Langhoff <martin.langhoff@gmail.com>
Date
Jun 7, 2012, 18:48 UTC
Message-ID
<CACPiFCJHY4vfrrWRm_cC2Ck6RAyQosWwqijxPbs+Fn0T_AoT1w@mail.gmail.com>
In-Reply-To
<7vy5nzgg1h.fsf@alter.siamese.dyndns.org>
On Thu, Jun 7, 2012 at 1:58 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Like more expensive -G that was recently added?

Yay! That does what I wanted, though the manpage relies on subtle wording to convey it. You have to read -S and -G twice and think about it. It would be much better to say something like "If -S isn't finding what you need, try -G and you shall find it" -- AFAICT it is true for the common cases.

gitk doesn't seem to know how to use it. Attached is a trivial patch (apologies about attaching it, in lieu of proper list style). Simple, and works for me.

While I am not learned in gitk internal structure, it seems complete. My only doubt is whether any additional work is needed under set known_view_options {}. I cannot quite fathom that part of gitk. Review welcome.

cheers,
m
-- 
 martin.langhoff@gmail.com
 martin@laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff


From d86137c8c2f2ac42b030a0e0b40c59c6029ccd4f Mon Sep 17 00:00:00 2001
From: Martin Langhoff <martin@laptop.org>
Date: Thu, 7 Jun 2012 14:41:58 -0400
Subject: [PATCH] gitk: add support for -G'regex' pickaxe variant

git log -G'regex' is a very usable alternative to the classic
pickaxe. Minimal patch to make it usable from gitk.
---
 gitk-git/gitk |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 22270ce..876b8f9 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2232,7 +2232,8 @@ proc makewindow {} {
     set gm [makedroplist .tf.lbar.gdttype gdttype \
 		[mc "containing:"] \
 		[mc "touching paths:"] \
-		[mc "adding/removing string:"]]
+		[mc "adding/removing string:"] \
+		[mc "changes match regex:"]]
     trace add variable gdttype write gdttype_change
     pack .tf.lbar.gdttype -side left -fill y
 
@@ -4595,6 +4596,8 @@ proc do_file_hl {serial} {
 	set gdtargs [concat -- $relative_paths]
     } elseif {$gdttype eq [mc "adding/removing string:"]} {
 	set gdtargs [list "-S$highlight_files"]
+    } elseif {$gdttype eq [mc "changes match regex:"]} {
+	set gdtargs [list "-G$highlight_files"]
     } else {
 	# must be "containing:", i.e. we're searching commit info
 	return
-- 
1.7.7.6
Previous: Junio C Hamano
Message 3 of 3 in “Getting pickaxe to perform looser matches, or regex matching”
  1. Martin LanghoffJun 7, 2012
  2. Junio C HamanoJun 7, 2012
  3. Martin LanghoffJun 7, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.