From: "brian m. carlson" <sandals@crustytoothpaste•net>
To: Karthik Nayak <karthik.188@gmail•com>
Cc: K Jayatheerth <jayatheerthkulkarni2005@gmail•com>,
ryenus@gmail•com, git@vger•kernel.org
Subject: Re: Re [bug] pull --prune could not delete references due to lock file already exists error
Date: Mon, 30 Jun 2025 14:20:16 +0000 [thread overview]
Message-ID: <aGKdICvmKlumU0ru@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <CAOLa=ZSA273KGPnwZ2aRBU_ybcCTYogBHvUwpa+5CfDOc2bEWg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]
On 2025-06-30 at 13:46:35, Karthik Nayak wrote:
> I can see few solutions overall (including the one you suggested).
>
> One solution is to drop duplicates in case insensitive systems, this is
> the shortest and easiest fix for now.
>
> Perhaps something like (untested back of the hand code):
>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index cc0a3deb61..bc79d74b82 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -1352,10 +1352,16 @@ static int prune_refs(struct display_state
> *display_state,
> goto cleanup;
> }
> } else {
> + const char *prev;
> struct string_list refnames = STRING_LIST_INIT_NODUP;
>
> - for (ref = stale_refs; ref; ref = ref->next)
> + for (ref = stale_refs; ref; ref = ref->next) {
> + if (ignore_case && prev && !strcasecmp(ref->next, prev))
> + continue;
> +
> string_list_append(&refnames, ref->name);
> + prev = ref->name;
> + }
This won't work in the general case, since the two refs that match case
insensitively aren't guaranteed to be adjacent. For instance:
refs/heads/AAAA
refs/heads/AAAB
refs/heads/aaaa
refs/heads/aaab
They'll be in the above order for a bytewise comparison, but the
matching entries won't be adjacent in the list.
Another option is for users on case-insensitive systems to use reftable,
which won't have the same problems as the file-based backend and will
preserve case properly.
--
brian m. carlson (they/them)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2025-06-30 14:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 12:32 [bug] pull --prune could not delete references due to lock file already exists error ryenus
2025-06-25 14:18 ` Re " K Jayatheerth
2025-06-27 18:59 ` brian m. carlson
2025-06-30 7:26 ` JAYATHEERTH K
2025-06-30 13:46 ` Karthik Nayak
2025-06-30 14:20 ` brian m. carlson [this message]
2025-06-30 21:10 ` Junio C Hamano
2025-07-01 10:31 ` Patrick Steinhardt
2025-07-01 16:14 ` Junio C Hamano
2025-07-02 8:50 ` Patrick Steinhardt
2025-07-01 8:20 ` Karthik Nayak
2025-07-02 4:50 ` Chris Torek
2025-07-02 15:37 ` Junio C Hamano
2025-07-01 0:52 ` JAYATHEERTH K
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=aGKdICvmKlumU0ru@fruit.crustytoothpaste.net \
--to=sandals@crustytoothpaste$(echo .)net \
--cc=git@vger$(echo .)kernel.org \
--cc=jayatheerthkulkarni2005@gmail$(echo .)com \
--cc=karthik.188@gmail$(echo .)com \
--cc=ryenus@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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