-
Notifications
You must be signed in to change notification settings - Fork 627
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
Improve behaviour of auto and periodic refresh modes #917
Conversation
@@ -780,10 +780,11 @@ get_input(int prompt_position, struct key *key) | |||
while (true) { | |||
int delay = -1; | |||
|
|||
if (opt_refresh_mode == REFRESH_MODE_PERIODIC) { | |||
if (opt_refresh_mode != REFRESH_MODE_MANUAL) { |
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 actually makes sense to me. Initially, the watch feature was lazy to avoid triggering a lot of unnecessary work. Clearly it was too lazy.
src/watch.c
Outdated
!index_diff(&diff, opt_show_untracked, false)) | ||
if (event == WATCH_EVENT_SWITCH_VIEW || | ||
!(check_file_mtime(&handler->last_modified, "%s/index", repo.git_dir) || | ||
index_diff(&diff, opt_show_untracked, false))) |
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.
👍 better captures the boolean logic here.
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 part was rewritten to make sure we can detect several successive modification.
This comment has been minimized.
This comment has been minimized.
4268489
to
284a914
Compare
src/stage.c
Outdated
@@ -459,8 +461,10 @@ stage_request(struct view *view, enum request request, struct line *line) | |||
|
|||
/* Check whether the staged entry still exists, and close the | |||
* stage view if it doesn't. */ | |||
if (view->parent && !stage_exists(view, &stage_status, stage_line_type)) | |||
if (view->parent && !stage_exists(view, &stage_status, stage_line_type)) { | |||
stage_line_type = 0; |
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.
Good point to clean up the state before closing
fbf9ee8
to
e670064
Compare
b5d05f6
to
0f00a6b
Compare
Still looks good to me. |
f409533
to
517d46e
Compare
517d46e
to
78012db
Compare
This PR should improve the current situation or, at least, make all the modes do something. There are still some (pre-existing) problems remaining but none of them is related in the existing issues.
As I don't use the periodic mode personally, I didn't look further but it looks to me that in this mode Tig refreshes unexpectedly 2 or 3 time at startup (hence the claim that it was working sometimes). Not the end of the world but for large repos it can be annoying.
The special handling of the stage view prevents a correct refresh of the status view in some cases.