Skip to content
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

Untracked only status view #909

Merged
merged 3 commits into from
Apr 12, 2019

Conversation

koutcher
Copy link
Collaborator

@koutcher koutcher commented Apr 6, 2019

Following discussions with @proski in #762, I decided to give a try to a "Untracked only" status view when called from the Untracked changes line. Having in mind the use case of checking quickly which files were left behind, this version seems indeed better than opening the regular status view and moving the cursor to the Untracked files currently implemented.

@jonas, the refresh part surely needs to be reviewed.

src/status.c Outdated
@@ -738,6 +746,8 @@ status_request(struct view *view, enum request request, struct line *line)
return request;
}

if (view->parent)
Copy link
Collaborator Author

@koutcher koutcher Apr 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonas, is it the proper way to trig a refresh of the parent view ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trigger a reload of the main view? Some views like stage has explicit logic based on the parent view if I recall correctly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed it and I also noticed there is no direct call to update_view, but I could not spot which part is the trigger for this logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it ! update_view is actually called for parent in main_status_exists itself called by stage_exists at the end of stage_request. So my code should be correct.

src/status.c Outdated
open_status_view(struct view *prev, bool untracked_only, enum open_flags flags)
{
show_untracked_only=untracked_only;
open_view(prev, &status_view, flags | OPEN_REFRESH);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the OPEN_REFRESH serving a purpose? It was not there in the inline version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, without it, if you open the status view from the Untracked changes line and then want to open it after with the s key to have the full content, then the content remains the Untracked only.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it causes an assertion failure.

src/status.c Outdated
@@ -738,6 +746,8 @@ status_request(struct view *view, enum request request, struct line *line)
return request;
}

if (view->parent)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trigger a reload of the main view? Some views like stage has explicit logic based on the parent view if I recall correctly.

@koutcher koutcher force-pushed the untracked-only-status-view branch 2 times, most recently from b07d66f to df70884 Compare April 9, 2019 21:06
@koutcher
Copy link
Collaborator Author

koutcher commented Apr 11, 2019 via email

@koutcher koutcher force-pushed the untracked-only-status-view branch from f0e349e to bc7f6d4 Compare April 12, 2019 05:10
@proski
Copy link
Contributor

proski commented Apr 12, 2019

I've tested the PR, the behavior is totally reasonable, fits well with the rest of tig.

Copy link
Owner

@jonas jonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to trying it!




[status] Nothing to update 100%
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet

@@ -738,6 +754,9 @@ status_request(struct view *view, enum request request, struct line *line)
return request;
}

if (show_untracked_only && view->parent && !main_status_exists(view->parent, LINE_STAT_UNTRACKED))
return REQ_VIEW_CLOSE;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the status can only ever have the main view as the parent it would still be good to have a view->parent == &main_view before calling main_status_exists.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wilco

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like "Impossible Germany" :-)
https://www.youtube.com/watch?v=r_0BPqWpM_M

@koutcher koutcher force-pushed the untracked-only-status-view branch from bc7f6d4 to 2b7bc4f Compare April 12, 2019 16:38
@koutcher
Copy link
Collaborator Author

koutcher commented Apr 12, 2019

I changed the view->parent test to view->parent == &main_view, rebased on master and squashed a bit.

@koutcher koutcher changed the title RFC Untracked only status view Untracked only status view Apr 12, 2019
@koutcher koutcher force-pushed the untracked-only-status-view branch from 2b7bc4f to 247f371 Compare April 12, 2019 17:20
@jonas
Copy link
Owner

jonas commented Apr 12, 2019

I'll let you merge.

@koutcher koutcher merged commit 6c1f9dd into jonas:master Apr 12, 2019
@koutcher koutcher deleted the untracked-only-status-view branch February 6, 2025 18:18
@koutcher koutcher restored the untracked-only-status-view branch February 6, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants