Skip to contentSkip to conversation

gitweb: Add support for grep searches

PATCH In review Petr Baudis 3 participants 6 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).

---

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

179 lines not on this page · raw message

#1 lore raw
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).

It seems that with basically a single exception, Git is remarkably unemotional and cold...

	http://repo.or.cz/w?p=git.git&a=search&h=HEAD&st=grep&s=hate%5B%5Ev%5D

...and pretty much all the feelings are brought to us from the wild CVS world...

	http://repo.or.cz/w?p=git.git&a=search&h=HEAD&st=grep&s=love

You could say that git lacks a human dimension here! Maybe we should at least
make it utter some awesome jokes at random moments (more usage errors = less jokes for the user, that'll teach 'em).

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
#3 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Petr Baudis
	http://repo.or.cz/w?p=git.git&a=search&h=HEAD&st=grep&s=hate%5B%5Ev%5D
Quoted 7 lines

That looks bogus. It doesn't find

- Documentation/git-cvsimport.txt:

git-cvsimport - Salvage your data out of another SCM people love to hate

Why?

Because it doesn't accept hate$, it should be like

	http://repo.or.cz/w?p=git.git&a=search&h=HEAD&st=grep&s=hate%28%5B%5Ev%5D%7C%24%29

or even better

	http://repo.or.cz/w?p=git.git&a=search&h=HEAD&st=grep&s=hate%5Cb

but in order to be able to use the regexps without breaking your backslash key and eyes, I think it's somewhat saner to accept extended regexps instead of basic regexps; YMMV, I'll let Junio or the list decide which way is better.

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

PATCH 1/1 gitweb: Add support for grep searches

In reply to Linus Torvalds

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 |  132 ++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 127 insertions(+), 9 deletions(-)
gitweb/gitweb.css +4 -0
index 2b023bd..c070d4b 100644
@@ -467,3 +467,7 @@ span.atnight {
 span.match {
 	color: #e00000;
 }
+
+div.binary {
+	font-style: italic;
+}
gitweb/gitweb.perl +123 -9

181 lines not on this page · raw message