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

Re: [PATCH v4 1/4] pack-write: make index-pack output comment hash agnostic

From
Justin Tobler <jltobler@gmail.com>
Date
Oct 26, 2026, 15:44 UTC
Message-ID
<at9v9p64l72xFEi8@denethor>
In-Reply-To
<CAOLa=ZTnEJDPB6_fdFQFcM=zV21HEZ4gzzhWqB=A_euSzUut_w@mail.gmail.com>
On 26/10/26 08:01AM, Karthik Nayak wrote:
Show 22 quoted lines
> Justin Tobler <jltobler@gmail.com> writes:
> 
> >  	/*
> > -	 * The first thing we expect from index-pack's output
> > -	 * is "pack\t%40s\n" or "keep\t%40s\n" (46 bytes) where
> > -	 * %40s is the newly created pack SHA1 name.  In the "keep"
> > -	 * case, we need it to remove the corresponding .keep file
> > -	 * later on.  If we don't get that then tough luck with it.
> > +	 * The first thing we expect from index-pack's output is
> > +	 * "pack\t<name>\n" or "keep\t<name>\n", where <name> is the hexadecimal
> > +	 * name of the packfile it has just written. The line is therefore five
> > +	 * bytes of prefix, `hexsz` bytes of name, and a trailing newline. A
> > +	 * "keep" prefix tells us that index-pack has also created the
> > +	 * corresponding ".keep" file.
> > +	 *
> > +	 * In the "keep" case, we need it to remove the corresponding ".keep"
> > +	 * file later on. If we don't get that then tough luck with it.
> 
> We start off saying we expect either '"pack\t<name>\n" or
> "keep\t<name>\n"'. But the last line makes it seem like the latter is
> always expected? Is that the case, or should this comment be moved to
> the caller in 'fetch-pack.c'?

Even though all callers of this function specify the `--keep` option to the git-index-pack(1) generating the output, it is expected that the output may be either "pack" or "keep". When git-index-pack(1) tries to create a lockfile, but one already exists, it simply ignores the error and returns a "pack" output line. The last line is from the original comment and indicates that when we do identify that a ".keep" file was created, it is something the caller must handle later on.

The intent of this patch was just to update the comment to be hash agnostic. The next patch splits out the `read_index_pack_report()` function from `index_pack_lockfile()` and the last comment line is removed accordingly. So I'm inclined to leave this patch as-is.

-Justin
Previous: Karthik NayakNext: Justin Tobler
Message 31 of 40 in “object-file: fix ".keep" lockfile ownership in ODB transactions”
  1. 0/3 object-file: fix ".keep" lockfile ownership in ODB transactionsJustin Tobler, Oct 16, 2026
  2. 1/3 pack-write: lift and expose index-pack report parsingJustin Tobler, Oct 16, 2026
  3. Patrick SteinhardtOct 16, 2026
  4. Justin ToblerOct 16, 2026
  5. 2/3 object-file: explicitly write ".keep" lockfileJustin Tobler, Oct 16, 2026
  6. Patrick SteinhardtOct 16, 2026
  7. Justin ToblerOct 16, 2026
  8. 3/3 object-file: write ".keep" lockfiles during transaction commitJustin Tobler, Oct 16, 2026
  9. Patrick SteinhardtOct 16, 2026
  10. Justin ToblerOct 16, 2026
  11. 0/4 object-file: fix ".keep" lockfile ownership in ODB transactionsJustin Tobler, Oct 16, 2026
  12. 1/4 pack-write: make index-pack output comment hash agnosticJustin Tobler, Oct 16, 2026
  13. 2/4 pack-write: lift and expose index-pack report parsingJustin Tobler, Oct 16, 2026
  14. 3/4 object-file: explicitly write ".keep" lockfileJustin Tobler, Oct 16, 2026
  15. Patrick SteinhardtOct 19, 2026
  16. Justin ToblerOct 19, 2026
  17. 4/4 object-file: write ".keep" lockfiles during transaction commitJustin Tobler, Oct 16, 2026
  18. Patrick SteinhardtOct 19, 2026
  19. 0/4 object-file: fix ".keep" lockfile ownership in ODB transactionsJustin Tobler, Oct 20, 2026
  20. 1/4 pack-write: make index-pack output comment hash agnosticJustin Tobler, Oct 20, 2026
  21. 2/4 pack-write: lift and expose index-pack report parsingJustin Tobler, Oct 20, 2026
  22. 3/4 object-file: explicitly write ".keep" lockfileJustin Tobler, Oct 20, 2026
  23. Patrick SteinhardtOct 20, 2026
  24. Justin ToblerOct 20, 2026
  25. Junio C HamanoOct 21, 2026
  26. 4/4 object-file: write ".keep" lockfiles during transaction commitJustin Tobler, Oct 20, 2026
  27. Patrick SteinhardtOct 20, 2026
  28. 0/4 object-file: fix ".keep" lockfile ownership in ODB transactionsJustin Tobler, Oct 21, 2026
  29. 1/4 pack-write: make index-pack output comment hash agnosticJustin Tobler, Oct 21, 2026
  30. Karthik NayakOct 26, 2026
  31. Justin ToblerOct 26, 2026
  32. 2/4 pack-write: lift and expose index-pack report parsingJustin Tobler, Oct 21, 2026
  33. 3/4 object-file: explicitly write ".keep" lockfileJustin Tobler, Oct 21, 2026
  34. Karthik NayakOct 26, 2026
  35. Justin ToblerOct 27, 2026
  36. Justin ToblerOct 27, 2026
  37. Karthik NayakOct 26, 2026
  38. 4/4 object-file: write ".keep" lockfiles during transaction commitJustin Tobler, Oct 21, 2026
  39. Karthik NayakOct 26, 2026
  40. Patrick SteinhardtOct 22, 2026

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.