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

Re: [PATCH 1/2] refs/reftable: don't fail empty transactions in repo without HEAD

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 4, 2024, 06:44 UTC
Message-ID
<ZeVtohtcxCCqUSlX@tanuki>
In-Reply-To
<xcbwno3x7tzcg77rtfkaqtqcgll32vhx5mlhcvlclew6lkkofu@h5jzvft55uvv>
On Thu, Feb 29, 2024 at 07:20:42PM -0600, Justin Tobler wrote:
Show 24 quoted lines
> On 24/02/27 03:27PM, Patrick Steinhardt wrote:
> > Under normal circumstances, it shouldn't ever happen that a repository
> > has no HEAD reference. In fact, git-update-ref(1) would fail any request
> > to delete the HEAD reference, and a newly initialized repository always
> > pre-creates it, too.
> > 
> > But in the next commit, we are going to change git-clone(1) to partially
> > initialize the refdb just up to the point where remote helpers can find
> > the repository. With that change, we are going to run into a situation
> > where repositories have no refs at all.
> > 
> > Now there is a very particular edge case in this situation: when
> > preparing an empty ref transacton, we end up returning whatever value
> > `read_ref_without_reload()` returned to the caller. Under normal
> > conditions this would be fine: "HEAD" should usually exist, and thus the
> > function would return `0`. But if "HEAD" doesn't exist, the function
> > returns a positive value which we end up returning to the caller.
> 
> In what context are reference transactions being created before the
> refdb is fully initialized? Is this in regards to repositories
> initialized with the reftables backend and used during execution of a
> remote-helper? I was originally under the impression that a partially
> initalized refdb would appear as the reffile backend before being fully
> initialized.
The only case where this can happen is during git-clone(1).
Patrick
Show 5 quoted lines
> > Fix this bug by resetting the return code to `0` and add a test.
> > 
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> 
> -Justin
Previous: Justin ToblerNext: Patrick Steinhardt
Message 10 of 18 in “builtin/clone: allow remote helpers to detect repo”
  1. 0/2 builtin/clone: allow remote helpers to detect repoPatrick Steinhardt, Feb 27, 2024
  2. 1/2 refs/reftable: don't fail empty transactions in repo without HEADPatrick Steinhardt, Feb 27, 2024
  3. Karthik NayakFeb 28, 2024
  4. Patrick SteinhardtMar 4, 2024
  5. Junio C HamanoMar 4, 2024
  6. Patrick SteinhardtMar 5, 2024
  7. Junio C HamanoMar 5, 2024
  8. t0610: remove unused variable assignmentPatrick Steinhardt, Mar 6, 2024
  9. Justin ToblerMar 1, 2024
  10. Patrick SteinhardtMar 4, 2024
  11. 2/2 builtin/clone: allow remote helpers to detect repoPatrick Steinhardt, Feb 27, 2024
  12. Junio C HamanoFeb 27, 2024
  13. Patrick SteinhardtMar 4, 2024
  14. Junio C HamanoMar 4, 2024
  15. Mike HommeyMay 3, 2024
  16. Junio C HamanoFeb 27, 2024
  17. Junio C HamanoFeb 27, 2024
  18. Patrick SteinhardtMar 4, 2024

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.