-
Notifications
You must be signed in to change notification settings - Fork 622
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 to auto refresh tig status if any file changes #301
Comments
Yes, it could. For now the auto refresh is quite stupid but at least it is supported regarless of whether the system supports inotify or not. |
I can't promise anything, but I'll try to do this. I work with emacs + magit all the time, but magit over tramp on a large Thanks for the tool.
|
@jaseemabid inotify is not recursive. I'd strongly discourage such an implementation if you don't want to enter a watcher and portability nightmare. I think the 'auto' or 'periodic' refresh-mode is quiet enough to handle refreshing the status view with a good compromise. |
@vivien The manual[1] don't talk much about this. Is there anything I can read to learn more? |
@jaseemabid the other main source of documentation is the tigrc manpage: http://jonas.nitro.dk/tig/tigrc.5.html, look for 'refresh-mode'. |
One way we could avoid introducing new platform code would be to have tig launch a script and read events from a stream. Each platform could then have separate shell script outputting the events. There's also https://github.com/alandipert/fswatch which supports most modern UNIX systems. The code is GPLv3+ so it could be integrated but would have to be converted form C++ to C. I don't think it would require that much platform specific code to go with the latter approach. However, it might be tricky to get the event reading right if some of the platform APIs rely on signals. FD-based APIs should be find, since we can simply add a check for new events to The current implementation is in:
Note that it currently relies on both file checking, for example The strategy for maintaining the state is really broken at the moment, so maybe we should come up with a better one for this first before piling more stuff on top of it. One issue is that the bitmasks don't work for tracking changes to events in the index. For example, if I open the stash view from the 'Unstaged' changes entry in the main view, it will register itself for Not sure if the above is somewhat clear. Anyway, the point is that to have reliable refreshing we need to change the watch module to track more information. |
A portable external tool is entr. A first approximation of entr monitoring a repo is git ls-files "$(git rev-parse --show-toplevel)" | entr -pd printf '%s\n' /_ with the only wrinkle being that entr has two modes of action: upon modification to the listed files, it executes the given command ( An interesting thought is while true; do git ls-files "$(git rev-parse --show-toplevel)" | entr -pd kill -USR1 "$TIG_PID"; kill -USR1 "$TIG_PID"; done |
Did this feature implement? what's the current status? I'd like to have a PR about this feature. |
Some time ago I sketched out an implementation indea in #734. It seems like the momentum got lost there. There is an unexplained test failure. However, I have been using that branch in my daily work for a long time without any problems. |
After #917 the legacy refresh modes should now work as expected. Is this new one still necessary ? |
@koutcher Currently I'm using tig |
It will be in the next version, for now you'd need to compile the master branch to use it. |
Built from master, for some reason
Note: for large repos maybe increase the refresh interval. |
What you should expect when |
@koutcher I see, thank you for clearing that up. Then I think I got mislead from reading the following in tigrc.5@master: |
Would it be less misleading if we change the documentation to When set to 'auto', views are refreshed when a modification is detected in another view. ? |
Yes, I think that surely helps. |
When I'm in tig status mode, and use Enter a file to view the diff, when I modify the file outside tig, is it able to refresh the diff view automatically? Currently I have to switch to the next file and switch back to previous file to refresh or exit the diff view and enter the diff view to show the diff , or manually refresh using my binding to the |
Can't this be done with inotify?
The text was updated successfully, but these errors were encountered: