On Sat, 5 May 2007, Karl Hasselstr?m wrote: > > On 2007-05-04 11:17:05 -0700, Carl Worth wrote: > > or by content of the patches themselves: > > > > git log -p -S'snippet of interest' > > Somewhat unrelated: how can I make gitk display these (and only these) > commits? git-log is not bad, but in 95% of cases I find gitk easier to > use. > > I know that I can ask it to highlight commits that insert or remove > "snippet of interest", but frequently the highlighted commits are ten > out of ten thousand, and not that easy to find even when boldfaced. > What I want is to make it display only those commits. The "-S" thing doesn't really interact well with "gitk", because it doesn't rewrite the parent information (it is basically just a "hide commits that don't pass this criteria"). As such, gitk, which requires parent information to generate the graph, is not very amenable to using "-S" and such. That said, you can apply this fairly trivial patch to "gitk" to make it parse the output of "git log" rather than "git rev-list", and that will actually get you working -S'xyz' parsing automatically. It's just that the commit history window will look like crap. This patch may be worth applying regardless, since there is really no real reason to use "git rev-list". In fact, I really like the ability to say gitk --stat and have the diffstat output visible in the commit window automatically ;) We might want to teach people that "git rev-list" isn't really all that useful any more, at least with the fancy stuff (it's still useful for just generating a list of objects, and for doing things like git rev-list v2.6.21.. | wc -l just to count commits). Junio, Paul? Linus --- gitk | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gitk b/gitk index b1c65d7..bec7bb9 100755 --- a/gitk +++ b/gitk @@ -33,8 +33,8 @@ proc start_rev_list {view} { set order "--date-order" } if {[catch { - set fd [open [concat | git rev-list --header $order \ - --parents --boundary --default HEAD $args] r] + set fd [open [concat | git log -z --pretty=raw $order \ + --parents --boundary $args] r] } err]} { puts stderr "Error executing git rev-list: $err" exit 1 @@ -129,7 +129,8 @@ proc getcommitlines {fd view} { set ok 0 set listed 1 if {$j >= 0} { - set ids [string range $cmit 0 [expr {$j - 1}]] + # start with 'commit ' + set ids [string range $cmit 6 [expr {$j - 1}]] if {[string range $ids 0 0] == "-"} { set listed 0 set ids [string range $ids 1 end] @@ -147,7 +148,7 @@ proc getcommitlines {fd view} { if {[string length $shortcmit] > 80} { set shortcmit "[string range $shortcmit 0 80]..." } - error_popup "Can't parse git rev-list output: {$shortcmit}" + error_popup "Can't parse git git log output: {$shortcmit}" exit 1 } set id [lindex $ids 0] - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html