git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-gui: Perform rescan on window focus-in

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 4, 2019, 18:56 UTC
Message-ID
<nycvar.QRO.7.76.6.1908042048100.46@tvgsbejvaqbjf.bet>
In-Reply-To
<a143dcfd-8067-34f7-97f3-c4482dca5819@yadavpratyush.com>
Hi,
On Sat, 3 Aug 2019, Pratyush Yadav wrote:
Show 24 quoted lines
> On 8/2/19 10:17 PM, Junio C Hamano wrote:
> > Pratyush Yadav <me@yadavpratyush.com> writes:
> >
> > > All right, the patch in its current state can't fly. So what is
> > > the correct way to do this? I see the following options:
> > >
> > > 1. Add this as an option that is disabled by default, but people
> > > who don't mind it can enable it. This is the easiest to implement.
> > > But I leave it to you and Junio (and anyone else who wants to
> > > pitch in :)) to decide if it is a good idea.
> >
> > I think this is a good first step.  As I said already, I am not
> > convinced that "focus in" is a good heuristics for triggering auto
> > rescan, and I suspect that you or others may come up with and
> > replace it with a better heuristic over time.  During that
> > experiment, it would be better to allow interested others to opt
> > into the feature to help, while not disturbing ordinary users who
> > are OK with the current behaviour.
> >
>
> All right. I'll look a bit more to see if I can figure something
> better. I suggested using filesystem watches. I'll wait a bit to hear
> from Johannes on what he thinks about it. He doesn't like the idea of
> using Watchman apparently.

It's not that I don't like the idea of watchman. What I don't like is the very limited number of scenarios where you can use watchman. It essentially boils down to... macOS.

From what I can tell, watchman really works best on macOS, it might work well on Linux, and it is in an "eternal beta" on Windows because none of the active developers have access to (or need for support on) Windows.

Also, using a filesystem monitor is quite a lot of overkill here, you only want to refresh the index smartly and pro-actively. Now you pile more and more complexity on top of the original patch, for little obvious benefit (and for added difficulties setting this up, because you can now no longer make this a default, as you have no idea whether watchman is installed or not, whether it works as intended or not if it is installed, and whether users will start to hate you for forcing this down their throats).

I want you to take a step back, consider what problem you originally tried to solve, and then come up with the simplest solution you can possibly come up with. If your solution is not simple, reject it.

I _could_ imagine, for example, that a focus-out event, followed by a configurable timeout (say, with the default being something like 10 seconds, which seems to me like a sensible minimum number of seconds to change anything commit-worthy), could be used by a focus-in event to trigger a refresh (with a message in the status bar what is happening and why), and that that would strike a sensible balance between benefit and complexity.

Ciao, Johannes

Previous: Pratyush YadavNext: Mark Levedahl
Message 19 of 23 in “git-gui: Perform rescan on window focus-in”
  1. git-gui: Perform rescan on window focus-inPratyush Yadav, Jul 28, 2019
  2. brian m. carlsonJul 28, 2019
  3. Pratyush YadavJul 28, 2019
  4. Pratyush YadavJul 28, 2019
  5. brian m. carlsonJul 28, 2019
  6. Mark LevedahlJul 29, 2019
  7. Mark LevedahlJul 29, 2019
  8. Pratyush YadavJul 29, 2019
  9. Johannes SchindelinJul 31, 2019
  10. Pratyush YadavAug 1, 2019
  11. Johannes SchindelinAug 2, 2019
  12. Pratyush YadavAug 2, 2019
  13. Johannes SchindelinAug 3, 2019
  14. Pratyush YadavAug 4, 2019
  15. Johannes SchindelinAug 4, 2019
  16. Pratyush YadavAug 4, 2019
  17. Junio C HamanoAug 2, 2019
  18. Pratyush YadavAug 2, 2019
  19. Johannes SchindelinAug 4, 2019
  20. Mark LevedahlJul 29, 2019
  21. Junio C HamanoJul 29, 2019
  22. Pratyush YadavJul 29, 2019
  23. Pratyush YadavJul 28, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.