Re: [PATCH v5 7/7] builtin/clone: teach git-clone(1) the --revision= option
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 5, 2025, 08:03 UTC
- Message-ID
- <Z6MbUbi1A6pTmRdx@pks.im>
- In-Reply-To
- <20250204-toon-clone-refs-v5-7-37e34af283c8@iotcl.com>
On Tue, Feb 04, 2025 at 10:34:06PM +0100, Toon Claes wrote:
Show 12 quoted lines
> @@ -580,8 +581,9 @@ static void update_head(const struct ref *our, const struct ref *remote,
> install_branch_config(0, head, remote_name, our->name);
> }
> } else if (our) {
> - struct commit *c = lookup_commit_reference(the_repository,
> - &our->old_oid);
> + struct commit *c = lookup_commit_or_die(&our->old_oid,
> + our->name);
> +
> /* --branch specifies a non-branch (i.e. tags), detach HEAD */
> refs_update_ref(get_main_ref_store(the_repository), msg,
> "HEAD", &c->object.oid, NULL, REF_NO_DEREF,I wonder: is this fixing a potential segfault? If so, it might make sense to split this out into a separate commit and provide a test that demonstrates the issue. If it doesn't, then the change shouldn't be necessary, unless I misunderstand.
Patrick