Skip to contentSkip to conversation

gitweb: Add support for grep searches

PATCH In review Petr Baudis 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitweb: Add support for grep searches

The 'grep' type of search greps the currently selected tree for given regexp and shows the results in a fancy table with links into blob view. The number of shown matches is limited to 1000 and the whole feature can be turned off (grepping linux-2.6.git already makes repo.or.cz a bit unhappy).

This second revision makes it in documentation explicit that grep accepts regexps, and makes grep accept extended regexps instead of basic regexps.

---

 gitweb/gitweb.css  |    4 ++
 gitweb/gitweb.perl |  123 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 125 insertions(+), 2 deletions(-)
gitweb/gitweb.css +4 -0
index 02623cb..9f0822f 100644
@@ -484,3 +484,7 @@ span.atnight {
 span.match {
 	color: #e00000;
 }
+
+div.binary {
+	font-style: italic;
+}
gitweb/gitweb.perl +121 -2

168 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Petr Baudis

This second revision makes it in documentation explicit that grep accepts regexps, and makes grep accept extended regexps instead of basic regexps.

I have thought about adding "[ ] regular expression" (or "Perl extended regexp", or something like that) checkbox for all searches:
'commit' (message), 'pickaxe' and the new 'grep'.

I have thought also about replaceing pickaxe search pipeline by
git log --pretty=format:%H -r --no-abbrev --raw -S<search> <hash>
but I'm not sure if pager would be turned off, and of performance compared to current pipeline:
git rev-list <hash> | git diff-tree -r --stdin -S<search>

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#2 lore raw
In reply to Petr Baudis

[Cc: Petr Baudis <[email protected]>, Junio C Hamano <[email protected]>,
[email protected]]

Quoted 5 lines · Petr Baudis

The 'grep' type of search greps the currently selected tree for given regexp and shows the results in a fancy table with links into blob view. The number of shown matches is limited to 1000 and the whole feature can be turned off (grepping linux-2.6.git already makes repo.or.cz a bit unhappy).

Ack, FWIW.

By the way, I wonder if we should make search context (view) sensitive. For example for 'history' view search would be limited to given pathspec, grep search in a 'tree' view would search given tree only.

Additionally it would be nice to have links from search results page to have search match highlighted, like search results on GitWiki.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#3 lore raw
Quoted 2 lines · Jakub Narebski

[Cc: Petr Baudis <[email protected]>, Junio C Hamano <[email protected]>,
[email protected]]

Your MUA seems to have finally decided to go completely crazy or something. :-) Different mails go to us and the list.

Quoted 9 lines
Quoted 5 lines · Petr Baudis

The 'grep' type of search greps the currently selected tree for given regexp and shows the results in a fancy table with links into blob view. The number of shown matches is limited to 1000 and the whole feature can be turned off (grepping linux-2.6.git already makes repo.or.cz a bit unhappy).

Ack, FWIW.

I want to implement the regexp checkbox.

Quoted 3 lines

By the way, I wonder if we should make search context (view) sensitive. For example for 'history' view search would be limited to given pathspec, grep search in a 'tree' view would search given tree only.

I think it would be nice (if it's clearly visible that the results are filtered), but I'm probably not the one who is going to implement this. ;-)

Quoted 2 lines

Additionally it would be nice to have links from search results page to have search match highlighted, like search results on GitWiki.

I'm sorry, I don't understand.

Signature · 4 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Ever try. Ever fail. No matter. // Try again. Fail again. Fail better.
		-- Samuel Beckett
#4 lore raw
Quoted 4 lines · Petr Baudis
Quoted 2 lines · Jakub Narebski

Additionally it would be nice to have links from search results page to have search match highlighted, like search results on GitWiki.

For example
http://git.or.cz/gitwiki/SubprojectSupport?highlight=%28Subproject%29

Quoted 1 line

I'm sorry, I don't understand.

For example search results for commit search ('author', 'committer' and 'commit' searches have link to 'commit' view. Pickaxe has link to 'commitdiff' view. Grep search would have link(s) to blob views. In those views the 's' (searchtext) parameter could be passed, and matched fragment should be somehow higlighted, e.g. using background color to not interfere with syntax highlighting.

Signature · 2 lines
Jakub Narebski
Poland