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

Re: Plugin mechanism(s) for Git?

From
Ben Peart <peartben@gmail.com>
Date
Jul 15, 2016, 15:52 UTC
Message-ID
<loom.20160715T175103-45@post.gmane.org>
In-Reply-To
<20160715133208.GA22711@sigill.intra.peff.net>
Jeff King <peff <at> peff.net> writes:
Show 28 quoted lines
> 
> On Fri, Jul 15, 2016 at 02:46:28PM +0200, Ævar Arnfjörð Bjarmason wrote:
> 
> > On Fri, Jul 15, 2016 at 2:18 PM, Jeff King <peff <at> peff.net> wrote:
> > > Some features, like the index-helper, aren't quite so easy. One reason
> > > is that its data needs to persist as a cache between multiple git
> > > invocations. In general, I think it would be nice to solve that by
> > > communicating via on-disk files, rather than a running daemon (just
> > > because it has fewer moving parts). But that's only half of it for
> > > index-helper. It needs to monitor inotify while git isn't running at
> > > all; so it really _does_ need some kind of long-running daemon.
> > 
> > This *may* have changed in the recent versions of the series, but I'm
> > fairly sure and for what it's worth to this discussion, that's not
> > what the index-helper does. It's there to keep the index file in
> > memory instead of reading it from disk.
> > 
> > It can *also* if you "git update-index --watchman" spawn a watchman
> > daemon in the background, which is the thing that'll be doing the
> > inotify calls and needs to stay persistent, the index-helper then
> > communicates with the watchman daemon "what changed since X?" to
> > compute a new index when requested.
> 
> Ah, yeah, you're right. Sorry for the confusion; I haven't actually
> followed the topic all that closely.
> 
> -Peff
> 
That's very close.  

Index-helper currently keeps the index alive in memory and shares it with git.exe via shm so it does need to persist as a daemon. Otherwise, it will have to be run again and load the index from disk which pretty much defeats the purpose. Currently, it times out after a prescribed time of not being used and shuts down to just to free up the resources.

The watchman daemon needs to _always_ be running so that it can monitor the working directory for changes and quickly provide the list of changed files and directories to git. This currently happens via index-helper but could be separated as the logic to use the data from watchman already exists in git. I have an RFC out that does exactly that.

Previous: Jeff King
Message 13 of 13 in “Plugin mechanism(s) for Git?”
  1. Christian CouderJul 15, 2016
  2. Lars SchneiderJul 15, 2016
  3. Ben PeartJul 15, 2016
  4. Konstantin KhomoutovJul 15, 2016
  5. Eric WongJul 15, 2016
  6. Duy NguyenJul 16, 2016
  7. Jeff KingJul 16, 2016
  8. Mike HommeyJul 15, 2016
  9. Junio C HamanoJul 15, 2016
  10. Jeff KingJul 15, 2016
  11. Ævar Arnfjörð BjarmasonJul 15, 2016
  12. Jeff KingJul 15, 2016
  13. Ben PeartJul 15, 2016

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.