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

Re: [PATCH v4] fast-import: allow 'from' to reference new commits and tags by oid

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 14, 2026, 22:42 UTC
Message-ID
<xmqqqzhrq4ye.fsf@gitster.g>
In-Reply-To
<pull.2252.v4.git.1792012956734.gitgitgadget@gmail.com>
"Marc Becker via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 36 quoted lines
> From: Marc Becker <becm@gmx.de>
>
> During a 'git fast-import' session, newly created objects are written
> to an in-progress packfile and recorded in fast-import's internal
> object table.  Until a 'checkpoint' command or the end of the session
> finalizes and indexes that packfile, these objects are not visible to
> the repository's object database via odb_read_object_peeled().
>
> Commands such as 'ls' (via parse_treeish_dataref() and dereference())
> and 'cat-blob' already account for this when given a hex object name:
> they look up the object in fast-import's internal object table with
> find_object() first and read it from the in-progress packfile with
> gfi_unpack_entry() when its '.pack_id' is not MAX_PACK_ID.
>
> By contrast, when 'from <committish>' (in a 'commit' or 'reset'
> command) is given a hex object name instead of a mark or branch name,
> parse_objectish() parses the hex string into 'b->oid' and calls
> parse_from_existing(), which unconditionally looks up the object via
> odb_read_object_peeled().  If the object is a commit or tag created in
> the current pack cycle, odb_read_object_peeled() returns NULL and
> fast-import dies with "fatal: not a valid commit: <oid>".
>
> Teach parse_from_existing() to look up 'b->oid' with find_object()
> first, peel any tag objects in the object table using dereference(),
> and unpack the target commit with gfi_unpack_entry() if it resides in
> the in-progress packfile, before falling back to
> odb_read_object_peeled() for objects in the repository's object
> database.
>
> Signed-off-by: Marc Becker <becm@gmx.de>
> ---
>     fast-import: fix lookup for new commits
>     
>     Changes since v3:
>     
>      * align here-doc indention in test with expected style
Thanks.  This round I have nothing more to add.
Will queue.
Previous: Marc Becker via GitGitGadget
Message 9 of 9 in “fast-import: fix lookup for new commits”
  1. fast-import: fix lookup for new commitsMarc Becker via GitGitGadget, Oct 10, 2026
  2. Aniket GuptaOct 11, 2026
  3. fast-import: fix lookup for new commits and tagsMarc Becker via GitGitGadget, Oct 12, 2026
  4. Junio C HamanoOct 13, 2026
  5. Junio C HamanoOct 13, 2026
  6. fast-import: allow 'from' to reference new commits and tags by oidMarc Becker via GitGitGadget, Oct 14, 2026
  7. Junio C HamanoOct 14, 2026
  8. fast-import: allow 'from' to reference new commits and tags by oidMarc Becker via GitGitGadget, Oct 14, 2026
  9. Junio C HamanoOct 14, 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.