-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Feature. Advanced Commit View: Filter files text field. #669
base: master
Are you sure you want to change the base?
Conversation
@lucasderraugh Lets discuss! |
@lucasderraugh What do you think about it? |
I’ll check it out on Tuesday. |
Very cool! Here's some of my thoughts on it:
Overall, this is pretty exciting. |
@lucasderraugh Could you draw an example of what you want? Also, we should not forget to reset search on window disappearing, because other controllers should not know about filtering. |
@lucasderraugh How could I set |
@lucasderraugh
|
@lucasderraugh Could you check it? |
Not sure about the first issue, but the second is because the object sending out the change is probably coming from the field editor (NSTextView). You should just query the current string value on searchField when receiving that update most likely. |
@lucasderraugh I solved it by adopting protocol and set delegate, it isn't an issue anymore :) |
@lucasderraugh Could we merge it? |
@lucasderraugh Any updates? |
Sorry @lolgear, I have been trying to finish a project whose deadline is at the end of the month. I’ll have more time in June to work on GitUp again. |
@lucasderraugh |
Yup, I started looking at some PRs last night. I’ll go through some of yours later this week. |
Alrighty, I’ll go through your stuff today :) |
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.
I'm trying to figure out if it should avoid being first responder or not. I generally like to hit tab to get down to the commit text at the bottom.
My biggest thing with this though is that it takes too long to do the diff on the commit. If I understand this correctly, we're only filtering by filenames, we aren't actually searching text in these commits. If this is the case then why do we need to recompute the diffs? If we're only going to filter by filename, then we should just do that at the table view level. We've already gone through the work of diffing everything.
<rect key="frame" x="0.0" y="0.0" width="300" height="27"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES"/> | ||
<subviews> | ||
<searchField wantsLayer="YES" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u4y-Fx-A8g"> |
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.
The search field should have placeholder text "Filter". We're not really searching any of the files.
I guess it would be a little difficult to move to table-view level. The main problem is index path as id. |
@lucasderraugh Any updates? |
@lucasderraugh |
…ottom left corner.
…uring search. Tooltip has been added.
… been removed from file pattern handler.
1468f4b
to
3eaab1c
Compare
@lucasderraugh Done. |
@lolgear I think the last thing I ask on this PR is that this is an opt-in feature and that by default we don't show any filter bar. For 99% of cases it's not really useful for me and I don't want to clutter the interface if it's not useful to people. If you can add a user default checkbox in Preferences that will toggle whether this filter field is shown or not then I can merge this in. |
@lucasderraugh Do I need additional tab in settings for this behavior? |
Let's keep the xibs and you can add it to the "General" tab for now. I'm going to move the "Appearance" based stuff into its own tab in a bit but lets keep the changes specific for this PR. |
…t view option has been added.
…mit view option has been added.
@lucasderraugh Done. |
@lucasderraugh |
I'll resolve the conflicts here and retest. Apologies on this one. |
@lolgear could you please attach a screenshot of result? |
_commitButton.enabled = _commitButton.enabled && !self.searchInProgress; | ||
|
||
if (self.searchInProgress) { | ||
_commitButton.toolTip = NSLocalizedString(@"Search in progress", @""); |
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.
nit: should it be localized?
Can this be finished? This is the single most important feature missing when you work with a monorepo. I have about 2700 files showing up in my worktree and it's super tedious to scroll manually. |
Yes, let me work on getting this in as it's on me at this point, I just lack the time to work on GitUp much these days. The reason it hasn't landed is because I don't want to allow filtering and committing at the same time as it's important to be able to know what is being committed. I think simply blocking commit if there is an active filter is the option I'd go with. There's also a consideration of disabling the feature in Settings that I'd like to introduce. All this is to say let me target getting it in this week and if it's not merged you can poke me again. |
How about adding some predefined filters like staged, changed, and untracked? Or adding a real-time updated list that always shows what a commit would include? And this feature should be very fast. I recognized that GU takes its time to rebuild the file list. When I switch to commit view initially it takes about 10s. When switching to another application and back, the update takes about 2s every time. That's pretty disturbing. |
@Robert-M-Muench This is a text filter, we already indicate staged and unstaged via the 2 lists. The text filter is fast as we’re not querying anything new. The long loading time when transitioning is another bug that I need to address separately. |
@lucasderraugh Not sure I understand. In the commit view, I see my working directory list (about 45000 files), which includes about 2700 files/uncommitted local changes (untracked, changed, etc.). How can I filter this list to show only changed files? Or untracked files with a specific pattern? |
view.translatesAutoresizingMaskIntoConstraints = NO; | ||
|
||
if (superview != nil && view != nil) { | ||
if (@available(macOS 10.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.
nit: @lolgear think about deprecate low mac versions
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.
@NikKovIos I’ll take a pass at cleaning this up on a new branch. The original author did enough on this one for me to push it over the finish line.
@@ -25,9 +25,12 @@ | |||
#import "GIColorView.h" | |||
#import "GIInterface.h" | |||
#import "GIWindowController.h" | |||
|
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.
Not needed spaces between imports
#pragma mark - Search | ||
- (void)setupSearch { | ||
self.searchTextField.delegate = self; | ||
self.searchTextField.placeholderString = NSLocalizedString(@"Filter files", nil); |
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.
nit: don't have localization
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.
It’s fine to go that direction anyways, perhaps even encouraged. Makes any future translation easier.
_commitButton.enabled = | ||
_indexStatus.modified | ||
|| (self.repository.state == kGCRepositoryState_Merge) | ||
|| self.amendButton.state; // Creating an empty commit is OK for a merge or when amending |
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.
don't commit anything that not involved into feature. code style is subjective.
Oh, forgot I left this one in a state where it’s on me. Let me resume fixing this branch up and addressing the commit concerns. |
Well, I would like to introduce another missing feature: File filtering. It is especially use in large commits.
I would like to have a feedback about this PR and feedback about roadmap of this feature.
Why it is not a final release?
I would like to add filtering functionality to each view ( view controller ) that requires it. Most of view controllers are consists of DiffFiles and DiffContents view controllers. However, it is not very simple to add this functionality into these small controllers.
So, I would like to add this functionality via inheritance from GIViewController or GIComposedViewController ( new entity ).
Fixes:
Further improvements:
We could add this functionality to GIDiffFilesViewController. If we do this, we could add search text field on every view that uses GIDiffFilesViewController. However, we should add also flag to indicate if we need this
searchField
or not.