After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 647879 - automatically refresh when repository changes
automatically refresh when repository changes
Status: RESOLVED FIXED
Product: gitg
Classification: Applications
Component: gui
0.2.x
Other Linux
: Normal enhancement
: ---
Assigned To: gitg-maint
gitg-maint
Depends on:
Blocks:
 
 
Reported: 2011-04-15 16:02 UTC by Adam Dingle
Modified: 2015-08-09 11:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Adam Dingle 2011-04-15 16:02:14 UTC
If I'm viewing a local repository in gitg and I modify the repository by running git from the command line, gitg won't automatically refresh its view: I have to choose View->Refresh.  Like Nautilus, gitg could monitor the repository directory and automatically refresh if anything changes.  That would be really nice.
Comment 1 jessevdk@gmail.com 2011-04-16 15:55:46 UTC
As a note, gitg already watches for fs changes and reloads. It doesn't watch everything though, and it can clearly be a bit improved.
Comment 2 Guilhèm Bonnefille 2011-04-18 09:19:46 UTC
IMHO, automatical refresh can be annoying sometimes because it can give the feeling of uncontrolling the application, impredictable changes while an GUI like gitg is an interface where user give orders to machine, not a sort of monitor where machine refresh constantly a certain state.

I think it could be useful to list what automatical refresh are good and which are bad.

IMHO:
* refreshing the whole history is not good as it is CPU consuming, refreshing refs (branches, tags...) is quite enough
* refreshing commit view is complex because it will need to monitor the whole working directory
...
Comment 3 Adam Dingle 2011-04-18 13:53:18 UTC
I agree that any auto-refresh operation must not consume a significant amount of CPU or other system resources - otherwise it's not worth doing.

I'm mostly interested in auto-refreshing refs.  It also might be possible to auto-refresh new commits cheaply without having to reread the whole history: when a ref has changed, maybe gitg could read the commit it points to, then follow the chain of parent commits until it gets to a commit it recognizes and then stop.  (I'm no expert on git, though, so I'd need to learn more about how git stores a repository before I could say confidently that this would be cheap).

Monitoring the whole working directory for files which have changed might not be so expensive, especially if we have a file monitoring mechanism that can inform us about changes in any directory or its subdirectories.
Comment 4 jessevdk@gmail.com 2011-04-19 08:37:13 UTC
To clarify, it is not the monitoring of the file system that is expensive (you can easily recursively monitor a directory). The problem is that currently gitg cannot do incremental updates of the history. I wanted to have this for quite some time, for example also when you commit something in gitg, that you don't need to reload the whole history (you "simply" insert a commit at the top). Of course, this is not that simple because of the way the history tree algorithm in gitg works. It's worth investigating though.
Comment 5 Aaron LaBella 2014-01-13 17:52:22 UTC
I'd actually prefer to *not* see this implemented.  If you're learning git, or even if you're a git expert, it is helpful to be able to see the git history *before* a change is made, and then refresh it when you're ready to see how it affects the tree.  I've taught quite a few folks on Windows (using tortoise git) and I've showed them this technique so that can learn to understand what their changes will do to the "tree".
Comment 6 Martin Meyer 2014-01-13 23:44:14 UTC
That's a good point, and I can see myself using that as a teaching tool as well. Could we make it an option then? I don't care what the default is (I can see both arguments already), but it would be nice to save me that extra step. I do a ton of repo management with branch rebasing, and there's a lot of ctrl+r as I git pull --all --prune from my terminal.
Comment 7 jessevdk@gmail.com 2014-01-14 11:47:27 UTC
I think the common way to go about this (for example, in gedit we do this), is to notify the user that there were external changes and ask if he/she wants to refresh to see them. This way you can have the best of both worlds. Ideally, instead of refreshing the whole history or refs tree, you could show the transition to the new state, so that it's obvious what has changed. This is one area of UI where animations can actually be very helpful. I can imagine that newly inserted refs will be animated into the tree, same for history. We can experiment with the implementation of this.

Note btw that this report was made against the original gitg. The newly released gitg doesn't actually have file monitoring at all yet.
Comment 8 jessevdk@gmail.com 2015-08-09 11:11:28 UTC
I've added monitoring of relevant files in .git and automatic updates of the various views. This is enabled by default, but can be disabled from the preferences.