{"thread":{"id":"64184","subject":"[PATCH] lockfile: add case insensitive filesystem note","startedAt":"2025-09-22T21:54:46Z","lastAt":"2025-09-23T09:03:51Z","messageCount":4,"participants":["Alan Da Costa via GitGitGadget","Junio C Hamano","Patrick Steinhardt","Karthik Nayak"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"526995","messageId":"pull.2053.git.git.1758578084468.gitgitgadget@gmail.com","threadId":"64184","inReplyTo":null,"subject":"[PATCH] lockfile: add case insensitive filesystem note","fromName":"Alan Da Costa via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-09-22T21:54:44Z","receivedAt":"2025-09-22T21:54:46Z","isPatch":true,"sender":{"key":"name:Alan Da Costa","avatar":null},"body":"From: Alan Da Costa <alandacosta@gmail.com>\n\n* Add note of case insensitive client filesystems may error due to a lock\n  on a case variant ref to more quickly identify failure in fetch/pull\n\nSigned-off-by: Alan Da Costa <alandacosta@gmail.com>\n---\n    lockfile: add case insensitive filesystem note\n    \n    When running git fetch or git pull on a case insensitive filesystem\n    (e.g., default macOS), if multiple case variants of the same remote ref\n    exist (often after a case-only rename), both variant locks map to the\n    same on-disk path. When a local update is required, Git creates a lock\n    for the first variant and then attempts to lock the second, which\n    collides with the same lock file, so an “existing lock” error is\n    reported. The underlying issue is mixed-case refs; resolve it by\n    consolidating the remote to a single-case variant and update local refs\n    accordingly.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2053%2Fadacosta%2Flockfile-add-case-insensitive-filesystem-note-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2053/adacosta/lockfile-add-case-insensitive-filesystem-note-v1\nPull-Request: https://github.com/git/git/pull/2053\n\n lockfile.c | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/lockfile.c b/lockfile.c\nindex 1d5ed01682..99a470bd3d 100644\n--- a/lockfile.c\n+++ b/lockfile.c\n@@ -156,7 +156,10 @@ void unable_to_lock_message(const char *path, int err, struct strbuf *buf)\n \t\t    \"an editor opened by 'git commit'. Please make sure all processes\\n\"\n \t\t    \"are terminated then try again. If it still fails, a git process\\n\"\n \t\t    \"may have crashed in this repository earlier:\\n\"\n-\t\t    \"remove the file manually to continue.\"),\n+\t\t    \"remove the file manually to continue.\\n\\n\"\n+\t\t    \"On case insensitive client filesystems, multiple mixed-case refs will resolve\\n\"\n+\t\t    \"to the same lock file, possibly causing this error. If so, ensure your remote\\n\"\n+\t\t    \"refs have a single case variant.\"),\n \t\t\t    absolute_path(path), strerror(err));\n \t} else\n \t\tstrbuf_addf(buf, _(\"Unable to create '%s.lock': %s\"),\n\nbase-commit: ab427cd991100e94792fce124b0934135abdea4b\n-- \ngitgitgadget\n"},{"id":"527001","messageId":"xmqq8qi6ruzo.fsf@gitster.g","threadId":"64184","inReplyTo":"pull.2053.git.git.1758578084468.gitgitgadget@gmail.com","subject":"Re: [PATCH] lockfile: add case insensitive filesystem note","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-09-22T22:19:07Z","receivedAt":"2025-09-22T22:19:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Alan Da Costa via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Alan Da Costa <alandacosta@gmail.com>\n>\n> * Add note of case insensitive client filesystems may error due to a lock\n>   on a case variant ref to more quickly identify failure in fetch/pull\n\nThis does not have to be a single-item bulletted list.  Please lose\nthe leading \"* \" from the first line, and \" \" from the second line,\nand finish the whole sentence with a full-stop \".\"\n\n> Signed-off-by: Alan Da Costa <alandacosta@gmail.com>\n> ---\n>\n>     When running git fetch or git pull on a case insensitive filesystem\n>     (e.g., default macOS), if multiple case variants of the same remote ref\n>     exist (often after a case-only rename), both variant locks map to the\n>     same on-disk path. When a local update is required, Git creates a lock\n>     for the first variant and then attempts to lock the second, which\n>     collides with the same lock file, so an “existing lock” error is\n>     reported.\n\nAnd the message update may help unconfusing the user who gets this\nerror, which is a good idea.  Thanks for working on this.\n\n>     The underlying issue is mixed-case refs; resolve it by\n>     consolidating the remote to a single-case variant and update local refs\n>     accordingly.\n\nThis does not seem to match anything the patch does, though ;-)\n\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2053%2Fadacosta%2Flockfile-add-case-insensitive-filesystem-note-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2053/adacosta/lockfile-add-case-insensitive-filesystem-note-v1\n> Pull-Request: https://github.com/git/git/pull/2053\n>\n>  lockfile.c | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n\n> diff --git a/lockfile.c b/lockfile.c\n> index 1d5ed01682..99a470bd3d 100644\n> --- a/lockfile.c\n> +++ b/lockfile.c\n> @@ -156,7 +156,10 @@ void unable_to_lock_message(const char *path, int err, struct strbuf *buf)\n>  \t\t    \"an editor opened by 'git commit'. Please make sure all processes\\n\"\n>  \t\t    \"are terminated then try again. If it still fails, a git process\\n\"\n>  \t\t    \"may have crashed in this repository earlier:\\n\"\n> -\t\t    \"remove the file manually to continue.\"),\n> +\t\t    \"remove the file manually to continue.\\n\\n\"\n> +\t\t    \"On case insensitive client filesystems, multiple mixed-case refs will resolve\\n\"\n> +\t\t    \"to the same lock file, possibly causing this error. If so, ensure your remote\\n\"\n> +\t\t    \"refs have a single case variant.\"),\n>  \t\t\t    absolute_path(path), strerror(err));\n\nThe two lines in the new part of the message seem to be longer than\nusual by two words or so.  Can you line wrap to balance?\n\nThe error is about our \"local\" filesystem, isn't it?  If you do not\nhave control over what the remote does, you have no recourse.  If\nusing the reftable backend on the local end work around the local\nfilesystem's case insensitivity, that would be a better suggestion\nto give that such a user can actually act on.\n\nIn any case, wouldn't it make more sense to do this change\nconditionally by looking at the value of the ignore_case global\n(which in turn came from the core.ignorecase setting in .git/config\nwhen the repository was created by probing the filesystem\ncapabilities)?  If you get this error and you are on a case\nsensitive system, the additional hints will lead the user to a\nwild goose chase.\n\nThanks.\n"},{"id":"527026","messageId":"aNJSnUGzzMlmrDQw@pks.im","threadId":"64184","inReplyTo":"pull.2053.git.git.1758578084468.gitgitgadget@gmail.com","subject":"Re: [PATCH] lockfile: add case insensitive filesystem note","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-09-23T07:56:13Z","receivedAt":"2025-09-23T07:56:20Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Mon, Sep 22, 2025 at 09:54:44PM +0000, Alan Da Costa via GitGitGadget wrote:\n> From: Alan Da Costa <alandacosta@gmail.com>\n> When running git fetch or git pull on a case insensitive filesystem\n> (e.g., default macOS), if multiple case variants of the same remote ref\n> exist (often after a case-only rename), both variant locks map to the\n> same on-disk path. When a local update is required, Git creates a lock\n> for the first variant and then attempts to lock the second, which\n> collides with the same lock file, so an “existing lock” error is\n> reported. The underlying issue is mixed-case refs; resolve it by\n> consolidating the remote to a single-case variant and update local refs\n> accordingly.\n\nAre you aware of Karthik's recent patch series at [1]? It looks like\nthis addresses your exact problem in a more direct way, and the\nresulting error messages that we have in that patch series also give a\nbit more advice for how to handle the situation.\n\nThe patch series wasn't merged yet, but will probably be merged soon.\nCould you maybe test that series and say whether it addresses your need?\n\nThanks!\n\nPatrick\n\n[1]: https://lore.kernel.org/git/20250902-587-git-fetch-1-fails-fetches-on-case-insensitive-repositories-v1-0-35e69bbb507d@gmail.com/\n"},{"id":"527031","messageId":"CAOLa=ZQKygjjW8s3wfyCyrv1CwHzHnmMPPSU_4pNAzEuy-hx+Q@mail.gmail.com","threadId":"64184","inReplyTo":"aNJSnUGzzMlmrDQw@pks.im","subject":"Re: [PATCH] lockfile: add case insensitive filesystem note","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-09-23T09:03:48Z","receivedAt":"2025-09-23T09:03:51Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Mon, Sep 22, 2025 at 09:54:44PM +0000, Alan Da Costa via GitGitGadget wrote:\n>> From: Alan Da Costa <alandacosta@gmail.com>\n>> When running git fetch or git pull on a case insensitive filesystem\n>> (e.g., default macOS), if multiple case variants of the same remote ref\n>> exist (often after a case-only rename), both variant locks map to the\n>> same on-disk path. When a local update is required, Git creates a lock\n>> for the first variant and then attempts to lock the second, which\n>> collides with the same lock file, so an “existing lock” error is\n>> reported. The underlying issue is mixed-case refs; resolve it by\n>> consolidating the remote to a single-case variant and update local refs\n>> accordingly.\n>\n> Are you aware of Karthik's recent patch series at [1]? It looks like\n> this addresses your exact problem in a more direct way, and the\n> resulting error messages that we have in that patch series also give a\n> bit more advice for how to handle the situation.\n>\n\nThanks for tagging me.\n\n>\n> The patch series wasn't merged yet, but will probably be merged soon.\n> Could you maybe test that series and say whether it addresses your need?\n>\n\nI agree. This should ideally be fixed with my series. Do let us know if\nyou test it. My series also has the added advantage that it would\nsuggest using reftables, wherein, the user can still use\ncase-conflicting refs in their repository.\n\n> Thanks!\n>\n> Patrick\n>\n> [1]: https://lore.kernel.org/git/20250902-587-git-fetch-1-fails-fetches-on-case-insensitive-repositories-v1-0-35e69bbb507d@gmail.com/\n"}]}