Re: Getting pickaxe to perform looser matches, or regex matching
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