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

[PATCH v4 0/2] rev-list: print additional missing object information

From
Justin Tobler <jltobler@gmail.com>
Date
Feb 5, 2025, 00:41 UTC
Message-ID
<20250205004147.887106-1-jltobler@gmail.com>
In-Reply-To
<20250201201658.11562-1-jltobler@gmail.com>
Greetings,

It is possible to configure git-rev-list(1) to print the OID of missing objects by setting the `--missing=print` option. While it is useful knowing about these objects, it would be nice to have even more context about the objects that are missing. Luckily, from an object containing the missing object, it is possible to infer additional information the missing object. For example, if the tree containing a missing blob still exists, the tree entry for the missing object should contain path and type information.

This series aims to provide git-rev-list(1) with a new `print-info` missing action for the `--missing` option that, when set, behaves like the existing `print` action but also prints other potentially interesting information about the missing object.

Missing object info is printed in the form `?<oid> [<token>=<value>]...` where multiple `<token>=<value>` pairs may be specified each separated from each other with a SP. Values that contain SP or LF characters are expected to be encoded in a manner such that these problematic bytes are handled. For missing object path information this is handled by quoting the path in the C style if it contains SP or special characters.

One concern I currently have with this quoting approach is that it is a bit more challenging to machine parse compared to something like using a null byte to delimit between missing info. One option is, in a followup series, introduce a git-for-each-ref(1) style format syntax. Maybe something like: `--missing=print-info:%(path)%00%(type)`. I'm curious if anyone may have thoughts around this. My goal is to ensure that there is an easy to use machine parsable interface to get this information. I could see something like `?<oid> path="foo \"bar" type=blob`, being a bit complex.

The series is set up as follows:
- Patch 1 introduces the `print-info` missing action and supports
  printing missing object path information.
- Patch 2 extends the `print-info` missing action to also print object
  type information about the missing object.
Changes in V4:
- The core.quotePath behavior is no longer force enabled for the missing
  info values. Consequently the first two patches from the previous
  version are dropped.

Thanks, -Justin

Justin Tobler (2):
  rev-list: add print-info action to print missing object path
  rev-list: extend print-info to print missing object type
 Documentation/rev-list-options.txt |  19 ++++++
 builtin/rev-list.c                 | 106 ++++++++++++++++++++++++-----
 t/t6022-rev-list-missing.sh        |  53 +++++++++++++++
 3 files changed, 161 insertions(+), 17 deletions(-)
Range-diff against v3:
1:  f628728300 < -:  ---------- quote: add c quote flag to ignore core.quotePath
2:  53a3811d8f < -:  ---------- quote: add quote_path() flag to ignore config
3:  fe7a3da8de ! 1:  e3d5295b4d rev-list: add print-info action to print missing object path
    @@ builtin/rev-list.c: static off_t get_object_disk_usage(struct object *obj)
     +		struct strbuf path = STRBUF_INIT;
     +
     +		strbuf_addstr(&sb, " path=");
    -+		quote_path(entry->path, NULL, &path,
    -+			   QUOTE_PATH_QUOTE_SP | QUOTE_PATH_IGNORE_CONFIG);
    ++		quote_path(entry->path, NULL, &path, QUOTE_PATH_QUOTE_SP);
     +		strbuf_addbuf(&sb, &path);
     +
     +		strbuf_release(&path);
4:  788b497d00 = 2:  6aa71444d3 rev-list: extend print-info to print missing object type
base-commit: b74ff38af58464688b211140b90ec90598d340c6
-- 
2.48.1.157.g3b0d05c4a7
Previous: Justin ToblerNext: Justin Tobler
Message 26 of 37 in “rev-list: print missing object type with --missing=print-type”
  1. rev-list: print missing object type with --missing=print-typeJustin Tobler, Jan 8, 2025
  2. Christian CouderJan 8, 2025
  3. Justin ToblerJan 8, 2025
  4. Junio C HamanoJan 8, 2025
  5. Justin ToblerJan 8, 2025
  6. Junio C HamanoJan 8, 2025
  7. Justin ToblerJan 8, 2025
  8. 0/2 rev-list: print additional missing object informationJustin Tobler, Jan 10, 2025
  9. 0/4 rev-list: print additional missing object informationJustin Tobler, Feb 1, 2025
  10. 1/4 quote: add c quote flag to ignore core.quotePathJustin Tobler, Feb 1, 2025
  11. Christian CouderFeb 3, 2025
  12. Junio C HamanoFeb 3, 2025
  13. Junio C HamanoFeb 3, 2025
  14. Junio C HamanoFeb 4, 2025
  15. Justin ToblerFeb 4, 2025
  16. 2/4 quote: add quote_path() flag to ignore configJustin Tobler, Feb 1, 2025
  17. Phillip WoodFeb 2, 2025
  18. Justin ToblerFeb 4, 2025
  19. Phillip WoodFeb 11, 2025
  20. Christian CouderFeb 3, 2025
  21. Junio C HamanoFeb 3, 2025
  22. 3/4 rev-list: add print-info action to print missing object pathJustin Tobler, Feb 1, 2025
  23. 4/4 rev-list: extend print-info to print missing object typeJustin Tobler, Feb 1, 2025
  24. Christian CouderFeb 3, 2025
  25. Justin ToblerFeb 4, 2025
  26. 0/2 rev-list: print additional missing object informationJustin Tobler, Feb 5, 2025
  27. 1/2 rev-list: add print-info action to print missing object pathJustin Tobler, Feb 5, 2025
  28. 2/2 rev-list: extend print-info to print missing object typeJustin Tobler, Feb 5, 2025
  29. Christian CouderFeb 5, 2025
  30. Justin ToblerFeb 5, 2025
  31. Junio C HamanoFeb 5, 2025
  32. Justin ToblerFeb 5, 2025
  33. Junio C HamanoFeb 5, 2025
  34. 1/2 rev-list: add --missing-info to print missing object pathJustin Tobler, Jan 10, 2025
  35. Christian CouderJan 10, 2025
  36. Junio C HamanoJan 10, 2025
  37. 2/2 rev-list: extend --missing-info to print missing object typeJustin Tobler, Jan 10, 2025

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.