From: Junio C Hamano <gitster@pobox.com>
To: "Marc Becker via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Aniket Gupta <aniketgupta3001@gmail.com>,
Marc Becker <becm@gmx.de>
Subject: Re: [PATCH v4] fast-import: allow 'from' to reference new commits and tags by oid
Date: Wed, 14 Oct 2026 15:42:49 -0700 [thread overview]
Message-ID: <xmqqqzhrq4ye.fsf@gitster.g> (raw)
In-Reply-To: <pull.2252.v4.git.1792012956734.gitgitgadget@gmail.com> (Marc Becker via GitGitGadget's message of "Wed, 14 Oct 2026 21:22:36 +0000")
"Marc Becker via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 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.
prev parent reply other threads:[~2026-10-14 22:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 17:24 [PATCH] fast-import: fix lookup for new commits Marc Becker via GitGitGadget
2026-10-11 19:38 ` Aniket Gupta
2026-10-12 22:50 ` [PATCH v2] fast-import: fix lookup for new commits and tags Marc Becker via GitGitGadget
2026-10-13 0:08 ` Junio C Hamano
2026-10-13 1:39 ` Junio C Hamano
2026-10-14 16:27 ` [PATCH v3] fast-import: allow 'from' to reference new commits and tags by oid Marc Becker via GitGitGadget
2026-10-14 19:36 ` Junio C Hamano
2026-10-14 21:22 ` [PATCH v4] " Marc Becker via GitGitGadget
2026-10-14 22:42 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqqzhrq4ye.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=aniketgupta3001@gmail.com \
--cc=becm@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.