-
-
Couldn't load subscription status.
- Fork 657
Add search bar at bottom of revlog #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I'm thinking a good way to implement this could be: in the log tab press |
|
@WizardOhio24 I don't see any change in the asyncgit crate which makes me assume you only filter on the local items. I would assume to filter the entire log history and not only the one we store in the application |
|
revlog.rs(37): so we only ever have 3k revision in memory at once. checkout a repo that has more than that and try to find something old, then it won't be searched. |
|
Tried Go to log tab That seems to work reasonably well. |
|
And it now filters all commits (I think), which might be expensive, so it only does it once when beginning a search, if it must. |
|
Everything seems to work in this now, just need to stop the help message opening when typing into the text input. |
|
@WizardOhio24 can you rebase this onto master? |
81a8849 to
f84f6f4
Compare
| anyhow = "1.0.38" | ||
| unicode-width = "0.1" | ||
| textwrap = "0.13" | ||
| parking_lot = "0.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what reasoning went into using Mutex from parking_lot vs using the regular Mutex from std that we use everywhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was because I think it's faster and it's already used as a dependency in some of the crates GitUI uses, happy to use the normal mutexes instead though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah lets keep it consistent
| | KeyCode::BackTab | ||
| | KeyCode::Delete | ||
| | KeyCode::Insert | ||
| | KeyCode::Esc => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what changed here?
| }) | ||
| } | ||
|
|
||
| fn get_what_to_filter_by( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this giant method could use some doc and test
| Self::get_tags(&filter_strings, &mut self.git_tags)?; | ||
|
|
||
| rayon_core::spawn(move || { | ||
| // Only 1 thread can filter at a time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use atomics in the other async bits to limit only one running at a time
| /// | ||
| /// vec [vec![A], vec![B, C, D], vec![E]] | ||
| #[allow(clippy::too_many_lines)] | ||
| pub fn filter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs unittesting
|
closing in favour of #672 |
|
I have been using tig for years, now I'm considering switching to lazygit or gitui, don't know which one is better, googled for a while, except for some benchmarks make two years ago, didn't find any useful info, so I tried to use both of them and decide by myself, just try gitui, didn't find a simple search function anywhere, it should be anywhere inside the session like tig or lazygit, so how to can find something in some tab like the list of log? Sorry, I'm switching to lazygit, or maybe back to tig if I'm not satisfied with lazygit. |

Closes #429, Closes #449, (part of 1.0 todo list)
Adds a search bar at the bottom of the log tab which allows for searching commits. It works, but I'm not sure what keys are best for accessing this. Go to
logtab then presss(suggested in #449), the search box will pop up and be in focus, type to search, the results will appear in the log where the arrow keys can scroll through them. Pressescto close the search box, thenescagain to cancel the search and return to all commits.TODO:
:s):a):m):t):!)||)&&):c)Make a wrapper around, not going to implement because it might not be better right nowgit_logwhich supports filtering and have revlog use that instead ofgit_logWithin the search:
:s xxxfilters only shas forxxx:a xxxfilters only authors forxxx:m xxxfilters only messages forxxx:t xxxfilters only tags forxxxThese can be combined to
:sam(any order works, so:asmor:smaworks as well) to search for all, which is equivalent to putting nothing at the startComplement filtering is possible with
:!, which returns anything not containing what was searched for, for example to get all commits whose messages do not contain 'fix' or 'remove'::!m fix &&:!m removeCase sensitive filtering is possible with
:c, for example, to find messages which contain 'Fix' and do not contain 'fix'::c FixThis also adds support for intersection filtering using
&&(i.e only if 'x' and 'y'), for example, to find commits where author name contains 'richard' and the commits message has 'fix' in it::a richard&&:m fixAnd support for union filtering using
||(i.e or), for example to find any commits whose message contains 'fix' or 'move' or any commits which contain aabb'::m fix ||:m move || aabb(notice spaces at start and end are irrelevant, they are trimmed, but
:must come before a space if filtering by something).Intersection is currently always higher priority than union, for example, to find commit message which contain 'fix' and 'readme' or contain
move=:m fix&&:m readme || movewhich is equivalent to((:m fix&&:m readme) || move ).And so, for a more complex query:
:m fix && :m revlog ||:a richard &&:m status ||:s aabb ||:mc Remove || :!cm biggerFor another example, show the commits which have tags where the commits contain 'pre' or ('fix' and 'CD'):
:t &&(:m pre ||(:m fix&&:m CD))Some screenshots