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

Fix for refresh-mode = periodic (issue #430). #591

Merged
merged 4 commits into from
Apr 29, 2017
Merged

Conversation

spytheman
Copy link
Contributor

No description provided.

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);
Copy link
Owner

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 {

Copy link
Contributor Author

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))
Copy link
Owner

Choose a reason for hiding this comment

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

Great catch.

Copy link
Contributor Author

@spytheman spytheman left a 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
Copy link
Contributor Author

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?

Copy link
Owner

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.

@jonas jonas merged commit f4fbccc into jonas:master Apr 29, 2017
@jonas
Copy link
Owner

jonas commented Apr 29, 2017

Thanks for fixing this!

@timotheecour
Copy link

timotheecour commented Mar 7, 2018

/cc @spytheman doesn't work for me: only refreshes the 1st time or so

koutcher added a commit that referenced this pull request Mar 2, 2020
The extra load_refs() introduced by #591 to fix #430 is no longer needed
after #917 and causes the loop.

Fixes #991
koutcher added a commit that referenced this pull request Oct 21, 2023
This is a regression from #991. Bring back and improve correction from #591.

Fixes #1270
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