After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 596770 - Search bar needs to be reimplemented (as a filtering search feature)
Search bar needs to be reimplemented (as a filtering search feature)
Status: RESOLVED OBSOLETE
Product: gitg
Classification: Applications
Component: gitg
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: gitg-maint
gitg-maint
Depends on:
Blocks:
 
 
Reported: 2009-09-29 18:32 UTC by Anders Kaseorg
Modified: 2018-05-22 13:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Anders Kaseorg 2009-09-29 18:32:36 UTC
If I type a string into the search bar, gitg selects the topmost matching commit.  It would be more useful if it would highlight all matches and let me cycle between them, like gitk does.
Comment 1 Nicolas Bigaouette 2010-12-23 15:33:07 UTC
Also, the find/search bar only searches commit messages, not commit ids. There should be a way to jump to specific ids.
Comment 2 Anders Kaseorg 2010-12-23 19:59:13 UTC
Nicolas: Agreed, but that should be a separate operation somehow.  gitg shouldn’t assume that I want to jump to a branch named “stuff” when I actually want to search for all commits mentioning “stuff”.  (gitk uses two different text boxes for these, for example.)
Comment 3 jessevdk@gmail.com 2010-12-26 11:14:25 UTC
Note that both statements are incorrect. gitg will go to the first match of a search, but then you can use the arrow keys to go the next match etc. Also, there is a menu when you click on the search icon that allows you to match also a hash for example.

That said, I really don't like the current search interface. It's functionality is not discoverable, it's slow and unintuitive to use. I will leave this bug open to track progress on the search stuff.

Ideally what I would like is to filter items based on the search criteria. However, the current implementation is not efficient and would have very bad performance on moderately large repositories. Help would be greatly appreciated.
Comment 4 Nicolas Bigaouette 2011-01-25 22:06:39 UTC
Jesse, you are right. The search box allows the arrows for next search, and clicking the icon can choose what kind of search (subject, author, date, hash).

I guess it's a usability issue problem then: after two months of usage I was still unaware of that feature!

But if you want to change how the search is performed, then this can be ignored.

I'm not sure I understand how you see the new search engine with the filter thing. What do you have in mind?
Comment 5 jessevdk@gmail.com 2011-01-26 13:21:01 UTC
What I would like to see is instead of scrolling the list to a match, to filter out all non matching items from the list. This will make it much easier to see which items match, and if you can find the one you need. Then there should be a shortcut to quickly clear the search so that you can also then investigate the history of that item properly.

For the search engine itself, I am not really sure what would be a good solution. It's currently fast for hashes, but anything else will simply do utf8 strstr on every item. This currently works reasonably because it will stop each time it finds the next item. Filtering this way however will lead to very bad performance. Ideally some kind of index (or suffix tree, or something similar) should be built from the items so searching is fast. I'm not sure how fast building the index would be, and if it would be possible to store a cache on disk, etc.
Comment 6 Sindhu S 2013-06-12 04:48:07 UTC
Currently, search is not implemented for history view (where commits are shown). 

Changing version to 'git head'and marking bug as 'NEW'.
Comment 7 Jean-François Fortin Tam 2014-12-15 02:28:45 UTC
Urgh. Just found out the hard way that this feature is gone in the new series. This is a huge regression for me as it was one of the killer features I used in gitg even in its previous imperfect state.

As for the backend... silly question: why not just search on the gtk model powering the listview widget? It can store data and filter the widget pretty easily with that, with good performance if I recall correctly.

Retitling this bug report for clarity, since it seems like the feature was actually really gone (not just that I couldn't find it, apparently).
Comment 8 jessevdk@gmail.com 2014-12-20 16:13:53 UTC
So, I just pushed a fix which enables again searching in the history. Note that this still doesn't filter the view, just searches in it. This is more or less the default tree view behavior, and seems to work fine for now. I'm undecided if we still want to go the filtering way.
Comment 9 Adam Dingle 2015-01-03 15:18:41 UTC
Jesse: thanks for this fix.  It's nice to be able to search commit messages, but unfortunately the search still won't find a commit by hash.  That's an essential feature in my opinion.

I personally would prefer a traditional search (find, find next) rather than a filter here.  I often want to see a search result in the tree along with its surrounding context (i.e. the commits that came before and after it).  It seems like a filter doesn't work well for that use case.
Comment 10 Adam Dingle 2015-01-03 15:28:42 UTC
Currently a search 'foo' matches only commits whose messages actually begin with the word 'foo', but not a commit with a message such as 'upgraded the foo'.  This is quite limiting.  I think a search should match any word visible in the tree view.
Comment 11 jessevdk@gmail.com 2015-01-05 09:16:53 UTC
Adam: yes, search is currently really basic (just the standard tree view column based search). Improving it is definitely planned. I actually thought it would already do partial searches (not just prefix), but that's apparently not true. In any case, I'll add this functionality (and searching hashes, refs) soon.
Comment 12 jessevdk@gmail.com 2015-01-05 20:12:19 UTC
commit 5651fc9483ab920bc2ecac98cccc8a75ff579ee3
Author: Jesse van den Kieboom <jessevdk@gmail.com>
Date:   Mon Jan 5 21:09:03 2015 +0100

    Improve search
    
    Searching now matches partially (not only prefixes) and
    will match on hashes.

This is a first improvement in the right direction. Note that you'll need libgit2-glib master for this as well.
Comment 13 Adam Dingle 2015-01-05 21:07:06 UTC
Jesse: I just built with your latest changes and search is now working much better - thanks so much!

One small point: when I type a hash and it's matched, it would be nice to highlight the matching portion of the hash in the lower part of the window.
Comment 14 jessevdk@gmail.com 2015-01-06 18:04:04 UTC
I'm not sure it's worth it in the case of hashes (although it's not that difficult to implement), since hashes are always matched as a prefix.
Comment 15 Adam Dingle 2015-01-09 00:24:49 UTC
Highlighting the matching portion of a hash would make it visually clearer why a particular commit was matched, so I'm still for it if it's easy.  Not a huge deal though.
Comment 16 Jakub Steiner 2015-05-05 12:08:04 UTC
My drive-by observation is that filtering the list would be a better behavior than in-place find with a pager. Granted we have the ability to clear the search without losing the selected commit for possibly getting more context.
Comment 17 Federico Bruni 2016-05-12 10:53:11 UTC
I see that the commit above was included in 3.15 release.
In fact I can search by commit hash on version 3.18.

I noticed that copying hashes from firefox and pasting them into gitg or gitk often doesn't work. While it works if I first paste on, say, gedit and then copy again from there into gitg/gitk.
Some html formatting is getting in the way, I guess.
Comment 18 GNOME Infrastructure Team 2018-05-22 13:02:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gitg/issues/5.