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

Re: [PATCH 0/8] Add 'ls-files --json' to dump the index in json

From
Duy Nguyen <pclouds@gmail.com>
Date
Jun 19, 2019, 12:42 UTC
Message-ID
<CACsJy8BkAPRQNgMQnCkOy3Wrdaj25uK8g-fQ3okpc3BZ33kzrQ@mail.gmail.com>
In-Reply-To
<a5d2d2e9-a22f-9ab8-f88f-9c8c8520735d@gmail.com>
On Wed, Jun 19, 2019 at 6:58 PM Derrick Stolee <stolee@gmail.com> wrote:
Show 21 quoted lines
>
> On 6/19/2019 5:58 AM, Nguyễn Thái Ngọc Duy wrote:
> > This is probably just my itch. Every time I have to do something with
> > the index, I need to add a little bit code here, a little bit there to
> > get a better "view" of the index.
> >
> > This solves it for me. It allows me to see pretty much everything in the
> > index (except really low detail stuff like pathname compression). It's
> > readable by human, but also easy to parse if you need to do statistics
> > and stuff. You could even do a "diff" between two indexes.
> >
> > I'm not really sure if anybody else finds this useful. Because if not,
> > I guess there's not much point trying to merge it to git.git just for a
> > single user. Maintaining off tree is still a pain for me, but I think
> > I can manage it.
>
> I think we (Microsoft/VFS for Git engineers) would use this tool, as we
> frequently need to diagnose something that went wrong in a user's index.
> Kevin Willford built a tool to search the index and figure out what's
> going on, but I'm not sure it parses all of the new extensions or was
> updated to parse the v5 index.

OK I suggest you try it out and see if it really fits your internal tools. I wanted to balance between manual inspection and automation so the output may not be the best for tools. I also try not to freeze the format for more wiggle room, which would be fine for one-time scripts, but if you want to have real tools depend on it, we may have to look harder at the output format and make sure it's good enough for some time, and have some documentation.

Also, I don't suppose it matters, but just for the record I don't care at all about --json performance. I suppose Jeff's json writer does not cache the entire json output in memory, so dumping giant index files is fine. But some other things, like reading the index with multiple threads, are also disabled.

-- 
Duy
Previous: Derrick StoleeNext: Derrick Stolee
Message 19 of 36 in “Add 'ls-files --json' to dump the index in json”
  1. 0/8 Add 'ls-files --json' to dump the index in jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  2. 1/8 ls-files: add --json to dump the indexNguyễn Thái Ngọc Duy, Jun 19, 2019
  3. Ævar Arnfjörð BjarmasonJun 19, 2019
  4. Derrick StoleeJun 19, 2019
  5. Johannes SchindelinJun 21, 2019
  6. Duy NguyenJun 24, 2019
  7. 2/8 split-index.c: dump "link" extension as jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  8. 3/8 fsmonitor.c: dump "FSMN" extension as jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  9. 4/8 resolve-undo.c: dump "REUC" extension as jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  10. Derrick StoleeJun 19, 2019
  11. 5/8 read-cache.c: dump "EOIE" extension as jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  12. 6/8 read-cache.c: dump "IEOT" extension as jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  13. Derrick StoleeJun 19, 2019
  14. Duy NguyenJun 19, 2019
  15. Derrick StoleeJun 19, 2019
  16. 7/8 cache-tree.c: dump "TREE" extension as jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  17. 8/8 dir.c: dump "UNTR" extension as jsonNguyễn Thái Ngọc Duy, Jun 19, 2019
  18. Derrick StoleeJun 19, 2019
  19. Duy NguyenJun 19, 2019
  20. Derrick StoleeJun 19, 2019
  21. Jeff KingJun 19, 2019
  22. Duy NguyenJun 21, 2019
  23. Jeff KingJun 21, 2019
  24. Johannes SchindelinJun 21, 2019
  25. Duy NguyenJun 21, 2019
  26. Junio C HamanoJun 21, 2019
  27. Jeff KingJun 21, 2019
  28. Johannes SchindelinJun 24, 2019
  29. Johannes SchindelinJun 24, 2019
  30. Duy NguyenJun 24, 2019
  31. Jeff KingJun 21, 2019
  32. Johannes SchindelinJun 24, 2019
  33. Junio C HamanoJun 20, 2019
  34. Jeff HostetlerJun 20, 2019
  35. brian m. carlsonJun 21, 2019
  36. Duy NguyenJun 22, 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.