-
Notifications
You must be signed in to change notification settings - Fork 616
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
Fix for refresh-mode = periodic (issue #430). #591
Conversation
src/display.c
Outdated
@@ -574,8 +574,10 @@ get_input(int prompt_position, struct key *key) | |||
delay = watch_periodic(opt_refresh_interval); | |||
foreach_displayed_view (view, i) { | |||
if (view_can_refresh(view) && | |||
watch_dirty(&view->watch)) | |||
watch_dirty(&view->watch)){ | |||
load_refs(true); |
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 would be nice to ensure load_refs
is only called once if a refresh is needed. For example by adding a bool refs_refreshed
outside the loop to guard.
Also please put a space before the {
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.
Done.
@@ -85,7 +85,7 @@ watch_head_handler(struct watch_handler *handler, enum watch_event event, enum w | |||
|
|||
// FIXME: check branch | |||
if ((head = get_ref_head()) && | |||
check_file_mtime(&handler->last_modified, "%s/refs/head/%s", repo.git_dir, head->name)) | |||
check_file_mtime(&handler->last_modified, "%s/refs/heads/%s", repo.git_dir, head->name)) |
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.
Great catch.
…d_refs(true) is called just once per one periodic cycle.
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.
Implementing a refs_refreshed guard so that load_refs(true) is called only once.
|
||
:exec @git add b.c | ||
:exec @git commit -m "Another change: hello" | ||
:exec @sleep 2 |
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 need an advice about test/main/refresh-periodic-test: as it is, I am not sure that it correctly checks that the automatic refresh works. Sleeping for several seconds through exec, seems to block the whole program, which is not the same as tig being idle for this time. Is there a better way to ensure that tig will just simply sit idle for a while?
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 will require some rework. I'll take a look.
Thanks for fixing this! |
/cc @spytheman doesn't work for me: only refreshes the 1st time or so |
No description provided.