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 v2] fast-import: fix lookup for new commits and tags
Date: Mon, 12 Oct 2026 18:39:58 -0700 [thread overview]
Message-ID: <xmqqik362xap.fsf@gitster.g> (raw)
In-Reply-To: <pull.2252.v2.git.1791845420568.gitgitgadget@gmail.com> (Marc Becker via GitGitGadget's message of "Mon, 12 Oct 2026 22:50:20 +0000")
"Marc Becker via GitGitGadget" <gitgitgadget@gmail.com> writes:
> diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
> index d9de2ef0d8..1f52be2c2c 100755
> --- a/t/t9300-fast-import.sh
> +++ b/t/t9300-fast-import.sh
> @@ -3938,4 +3938,72 @@ test_expect_success 'Y: rewrite submodules' '
> )
> '
>
> +cat >Y-reference-pending-sha256 <<\Y_INPUT_END
> +commit refs/heads/main
> +committer A U Thor <author@example.com> 1712563200 +0000
> +data 14
> +commit message
> +M 644 inline test file
> +data 14
> +dummy content
> +
> +tag newtag
> +from 17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d
> +tagger A U Thor <author@example.com> 1712563300 +0000
> +data 11
> +tag message
> +# no emty line after tag data!
> +reset refs/heads/other
> +from 85edc5eac315bc680677b2fc71622bd77476f057eb8dc8ed6a497803a24f1f46
> +
> +commit refs/heads/further
> +committer A U Thor <author@example.com> 1712563400 +0000
> +data 21
> +what about 2nd commit
> +from 17e650f097a4db6fe069c96935360d3ccc9b35c4018728c5f311a4217c2ced3d
> +M 644 inline other test file
> +data 19
> +more dummy content
> +
> +done
> +Y_INPUT_END
> +
> +cat >Y-reference-pending-sha1 <<\Y_INPUT_END
> +commit refs/heads/main
> +committer A U Thor <author@example.com> 1712563200 +0000
> +data 14
> +commit message
> +M 644 inline test file
> +data 14
> +dummy content
> +
> +tag newtag
> +from 85b46dd918355ff17b4109ec738723d42f235a04
> +tagger A U Thor <author@example.com> 1712563300 +0000
> +data 11
> +tag message
> +# no emty line after tag data!
> +reset refs/heads/other
> +from ec6c4db71feb5f66615214dad2324ce030e777a7
> +
> +commit refs/heads/further
> +committer A U Thor <author@example.com> 1712563400 +0000
> +data 21
> +what about 2nd commit
> +from 85b46dd918355ff17b4109ec738723d42f235a04
> +M 644 inline other test file
> +data 19
> +more dummy content
> +
> +done
> +Y_INPUT_END
The above duplicates a rather simple test, and only differences
between them are the embedded object names. Can't you use the
test_oid_cache & test_oid mechanism to reduce the repetition to
make the tests easier to maintain? It may look something like this:
test_expect_success 'Y: reference pending tag or commit' '
test_oid_cache <<-EOF &&
pending_commit sha1:86b46d....5a04
pending_commit sha256:17e65...ed3d
pending_tag sha1:ec6c6d...77a7
pending_tag sha256:85edc5...1f46
EOF
git init reference-pending &&
(
cd reference-pending &&
git fast-import <<-EOF &&
commit refs/heads/main
committer A U Thor <author@example.com> 1712563200 +0000
...
dummy content
tag newtag
from $(test_oid pending_commit)
tagger A U Thor <author@example.com> 1712563300 +0000
...
data 19
more dummy content
done
EOF
)
'
prev parent reply other threads:[~2026-10-13 1:40 UTC|newest]
Thread overview: 5+ 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 [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=xmqqik362xap.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.