git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Pratyush Yadav <me@yadavpratyush.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Luigi Cantoni <luigic@fgcint.com>,
	git@vger.kernel.org
Subject: Re: Auto Rescan - as plain text
Date: Mon, 29 Jun 2020 23:37:06 -0700	[thread overview]
Message-ID: <20200630063706.GA1962986@gmail.com> (raw)
In-Reply-To: <20200610085902.uv7cxl6s5qnlniwm@yadavpratyush.com>

On Wed, Jun 10, 2020 at 02:29:02PM +0530, Pratyush Yadav wrote:
> Hi Junio,
> 
> On 09/06/20 05:16PM, Junio C Hamano wrote:
> > Luigi Cantoni <luigic@fgcint.com> writes:
> > 
> > > Hi All,
> > > I have been using git for several years now and using git-cola.
> > > I just started up git gui and that is quite self explanatory and all
> > > the functions I use with git-cola appear to be there.
> > 
> > We used to see the maintainer of that project around here quite
> > frequently but haven't seen him for a while [jch: David Cc'ed].
> > 
> > By reading https://git-cola.github.io/about.html it seems that they
> > prefer to see problem reports and feature requests at
> > https://github.com/git-cola/git-cola/issues and not on this list.
> 
> The feature request is for git-gui, asking for auto rescan in git-gui 
> like git-cola has. So I think this is the right place for it. Though I 
> think its easy to miss that on a quick read of the email. I had to do a 
> double take too :-)

Hi, I'm glad you like git-cola.

In the OP missed it, the git-gui maintainer's repo is here:

https://github.com/prati0100/git-gui


> > > One thing I liked in git-cola was that it very quickly reflected my
> > > changes in its display window.
> > > I have looked in the options and I cannot see either a flag to set it
> > > to auto rescan or set a time for the auto rescan.
> > >
> > > Have I missed it and there is a way turn this on or give it a shorter
> > > time (if in fact it is does do it).
> > > If it is not offered could it become an option.
> > > I can see that some people may not feel the overhead for distributed
> > > system is worth having this on so they would want if off.
> > > It is not critical (just nice) as I know I can
> > > 1) rescan
> > > or 2) go off the file and back on again.
> > > It then displays the correct diff/updated contents.
> > >
> > > Thanks for any advise or help.
> 
> -- 
> Regards,
> Pratyush Yadav


I'd be happy to explain how we implemented the "live refresh feature
in git-cola.

We have a few different approaches.  First, we integrate with inotify
on Linux.  When we notice that files have been written, we refresh our
state.  That's the happy path.

On Windows someone wrote an equivalent thing using some Windows file
monitoring APIs.

I don't think we currently have a macOS file monitoring part yet, but I
imagine there's probably a way to do it there too.

We're in Python, so we had the flexibility of what Python provides.
Git GUI will have access to anything tcl/tk / wish can do, but I'm
not familiar enough to know what's possible.

One thing we did do for users that don't have native file monitoring, is
that someone requested a preference, eg. "gui.refreshOnFocus", which
would make the GUI refresh whenever it gets focus from the window
manager.  This can be helpful, though it will make it take that extra
hit every time you switch between windows.  That might be something
that's possible to implement if something like inotify is not available,
though, and can be convenient for users that don't mind the hit.

Question for Luigui, how do you refresh the GUI?
Do you click on the "Rescan" button, or do you use the "Ctrl-R" hotkey?

One very nice but subtle detail that is not immediately obvious
from your description of how git-cola works is that if you have a file
selected, and something changes, we refresh the diff and keep the
viewport at the same location so that the changes appear right there,
immediately.  You mentioned:

> or 2) go off the file and back on again.

Which suggests that you have to deselect the file and reselect it to get
git-gui to redo the diff display.  You'll also lose the scrollbar
position if you do that, eg. if you are scrolled in the middle of a
large diff, you're going to lose your place.  That's why we
special-cased this behavior in cola and made it so that the rescan
behavior will redo the diff when a file is selected.

We go through great effort in cola to handle this in the nicest way
possible.  We  retaining the scrollbar/viewport position, redo the
diff, and ensure that if the user had something selected in the
text area, and the diff changes, that we attempt to re-select the text
that they may have selected, even if it changed lines.  The selection is
moreso content-centric than line-centric.

If they had something selected that went away, then their text selection
will be lost, but that's totally expected and natural.

I have a lot of opinions about how that tool should work, whch is really
why git-cola exists.  The diff/index editing part is really the killer
feature.

I ask how you refresh the GUI because cola is designed to be driven
entirely by keyboard shortcuts, and has vim-like hotkeys because I dig
building upon existing conventions and my vim muscle memory.

My main sug for git-gui would be to make it so that you don't have to
use a mouse.  Making it so that it can do the entire partial
staging/unstaging/revert workflow using line selection and keyboard
hotkeys would be my personal sug for feature requests.

If someone adds it, please use the "s" hotkey to stage/unstage selected
lines (or the hunk at the text cursor position, if nothing is selected),
"ctrl-u" to revert changes the same way, and "ctrl-s" to stage/unstage
the entire file, would be my personal sugs.

Parity with git-cola is always a nice goal within reason ;-) that way
folks won't have to re-learn these hotkeys across the tools.
-- 
David

  parent reply	other threads:[~2020-06-30  6:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <37bd22ee8bcb9c91969d68cbc5e6852a8a70ab36.camel@fgcint.com>
     [not found] ` <bf895dc550881b35baea45cd269bf9b0518ade35.camel@fgcint.com>
     [not found]   ` <816ce248ab1708d41b5233abdb998ff2d4cb3400.camel@fgcint.com>
2020-06-10  0:09     ` Auto Rescan - as plain text Luigi Cantoni
2020-06-10  0:16       ` Junio C Hamano
2020-06-10  8:59         ` Pratyush Yadav
2020-06-10 16:57           ` Junio C Hamano
2020-06-30  6:37           ` David Aguilar [this message]
2020-06-10  8:51       ` Pratyush Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200630063706.GA1962986@gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=luigic@fgcint.com \
    --cc=me@yadavpratyush.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).