From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Han Jiang <jhcarl0814@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: `git remote rename` does not work when `refs/remotes/server/HEAD` is unborn (when right after `git remote add -m`)
Date: Fri, 25 Jul 2025 10:00:55 +0200 [thread overview]
Message-ID: <aIM5t3NMk9N0570v@pks.im> (raw)
In-Reply-To: <xmqqbjp9h1sk.fsf@gitster.g>
On Thu, Jul 24, 2025 at 11:38:35AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
[snip]
> > + if (flags & REF_ISSYMREF) {
> > + strbuf_addstr(&new_referent, referent);
> > + strbuf_splice(&new_referent, strlen("refs/remotes/"), strlen(rename->old_name),
> > + rename->new_name, strlen(rename->new_name));
> > + oid = NULL;
> > + }
> > +
> > + error = ref_transaction_delete(rename->transaction, refname,
> > + oid, referent, REF_NO_DEREF, NULL, rename->err);
>
> Remove old ...
>
> > + if (error < 0)
> > + goto out;
> > +
> > + strbuf_reset(&new_refname);
> > + strbuf_addstr(&new_refname, refname);
> > + strbuf_splice(&new_refname, strlen("refs/remotes/"), strlen(rename->old_name),
> > + rename->new_name, strlen(rename->new_name));
> > +
> > + error = ref_transaction_update(rename->transaction, new_refname.buf, oid,
> > + null_oid(the_hash_algo), (flags & REF_ISSYMREF) ? new_referent.buf : NULL, NULL,
> > + REF_SKIP_CREATE_REFLOG | REF_NO_DEREF | REF_SKIP_OID_VERIFICATION,
> > + NULL, rename->err);
>
> ... and create new. Would we be hit with the same "while renaming A
> to A/B, there is a D/F conflict which the ref transaction does not
> handle by itself" issue we saw recently here?
Yes, we do indeed. I've now split this up into two transactions that get
populated concurrently.
Patrick
next prev parent reply other threads:[~2025-07-25 8:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 9:59 `git remote rename` does not work when `refs/remotes/server/HEAD` is unborn (when right after `git remote add -m`) Han Jiang
2025-07-24 10:45 ` Jeff King
2025-07-24 11:58 ` Patrick Steinhardt
2025-07-24 13:03 ` Patrick Steinhardt
2025-07-24 18:38 ` Junio C Hamano
2025-07-25 8:00 ` Patrick Steinhardt [this message]
2025-07-25 11:02 ` Jeff King
2025-07-25 11:13 ` Jeff King
2025-07-28 6:05 ` Patrick Steinhardt
2025-07-28 6:05 ` Patrick Steinhardt
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=aIM5t3NMk9N0570v@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jhcarl0814@gmail.com \
--cc=peff@peff.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).