Skip to content

Conversation

adacosta
Copy link

@adacosta adacosta commented Sep 12, 2025

When running git fetch or git pull on a case insensitive filesystem (e.g., default macOS), if multiple case variants of the same remote ref exist (often after a case-only rename), both variant locks map to the same on-disk path. When a local update is required, Git creates a lock for the first variant and then attempts to lock the second, which collides with the same lock file, so an “existing lock” error is reported. The underlying issue is mixed-case refs; resolve it by consolidating the remote to a single-case variant and update local refs accordingly.

cc: Patrick Steinhardt ps@pks.im
cc: Karthik Nayak karthik.188@gmail.com

Copy link

Welcome to GitGitGadget

Hi @adacosta, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that either:

  • Your Pull Request has a good description, if it consists of multiple commits, as it will be used as cover letter.
  • Your Pull Request description is empty, if it consists of a single commit, as the commit message should be descriptive enough by itself.

You can CC potential reviewers by adding a footer to the PR description with the following syntax:

CC: Revi Ewer <revi.ewer@example.com>, Ill Takalook <ill.takalook@example.net>

NOTE: DO NOT copy/paste your CC list from a previous GGG PR's description,
because it will result in a malformed CC list on the mailing list. See
example.

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

  • the lines should not exceed 76 columns,
  • the first line should be like a header and typically start with a prefix like "tests:" or "revisions:" to state which subsystem the change is about, and
  • the commit messages' body should be describing the "why?" of the change.
  • Finally, the commit messages should end in a Signed-off-by: line matching the commits' author.

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the Libera Chat IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this. Note that any reviewers CC'd via the list in the PR description will not actually be sent emails.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Libera Chat. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

Copy link

There are issues in commit 1f3461a:
lockfile: add case insensitive filesystem note
Commit checks stopped - the message is too short
Commit not signed off

@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from 1f3461a to c59187c Compare September 12, 2025 19:36
Copy link

There are issues in commit c59187c:
lockfile: add case insensitive filesystem note
Commit checks stopped - the message is too short
Commit not signed off

@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from c59187c to 0005140 Compare September 12, 2025 19:38
Copy link

There are issues in commit 0005140:
lockfile: add case insensitive filesystem note
Commit checks stopped - the message is too short
Commit not signed off

@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from 0005140 to e7e4b0e Compare September 12, 2025 19:42
Copy link

There are issues in commit e7e4b0e:
doc: add case insensitive filesystem note
Commit checks stopped - the message is too short
Commit not signed off

@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from e7e4b0e to 40a07f1 Compare September 12, 2025 19:46
Copy link

There are issues in commit 40a07f1:
doc: add case insensitive filesystem note
Commit not signed off

@adacosta adacosta changed the title lockfile: add case insensitive filesystem note doc: add case insensitive filesystem note Sep 12, 2025
@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from 40a07f1 to 6b39e64 Compare September 12, 2025 20:39
Copy link

There are issues in commit 6b39e64:
doc: add case insensitive filesystem note
Commit not signed off

@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from 6b39e64 to 0ab95ab Compare September 12, 2025 20:40
@adacosta adacosta changed the title doc: add case insensitive filesystem note lockfile: add case insensitive filesystem note Sep 12, 2025
Copy link

There are issues in commit 0ab95ab:
lockfile: add case insensitive filesystem note
Commit not signed off

@dscho
Copy link
Member

dscho commented Sep 13, 2025

/allow

Copy link

User adacosta is now allowed to use GitGitGadget.

@dscho
Copy link
Member

dscho commented Sep 13, 2025

@adacosta the Git project is very particular with commit messages. You will want to review the guidance in https://github.blog/2022-06-30-write-better-commits-build-better-projects/ to improve your commit message (git commit --amend), in particular with a strong focus on this part:

  What you’re doing Why you’re doing it
High-level (strategic) Intent (what does this accomplish?) Context (why does the code do what it does now?)
Low-level (tactical) Implementation (what did you do to accomplish your goal?) Justification (why is this change being made?)

Also, could you please sign off on your patch? The Git project insists on that. You can fix it by git commit --amend --signoff, and force-pushing.

I am sorry for all the red tape...

@stratigos
Copy link

I think this PR will be helpful to developers facing this issue, as it eliminates the time it takes to understand the issue and fix it within one's repository or filesystem.

@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from 0ab95ab to f5f492c Compare September 15, 2025 17:42
@adacosta
Copy link
Author

@dscho thanks for the feedback! Not included in my patch are the translations because I'm not sure how they're handled. Does my PR need to be flagged to translate? For an example of files, search "Another git process seems to be running in this repository".

@dscho
Copy link
Member

dscho commented Sep 15, 2025

Not included in my patch are the translations because I'm not sure how they're handled. Does my PR need to be flagged to translate?

The message you modify is enclosed in _(...). That marks it for translation, and the excellent translators over at https://github.com/git-l10n/git-po typically do a very good job at adjusting the translations during the "-rc phase" short before the next .0 version comes out.

@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from f5f492c to d240776 Compare September 15, 2025 18:30
@dscho
Copy link
Member

dscho commented Sep 17, 2025

@adacosta did you mean to /submit this?

@adacosta
Copy link
Author

/submit

Copy link

Submitted as pull.2053.git.git.1758578084468.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2053/adacosta/lockfile-add-case-insensitive-filesystem-note-v1

To fetch this version to local tag pr-git-2053/adacosta/lockfile-add-case-insensitive-filesystem-note-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2053/adacosta/lockfile-add-case-insensitive-filesystem-note-v1

Copy link

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Alan Da Costa via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Alan Da Costa <alandacosta@gmail.com>
>
> * Add note of case insensitive client filesystems may error due to a lock
>   on a case variant ref to more quickly identify failure in fetch/pull

This does not have to be a single-item bulletted list.  Please lose
the leading "* " from the first line, and " " from the second line,
and finish the whole sentence with a full-stop "."

> Signed-off-by: Alan Da Costa <alandacosta@gmail.com>
> ---
>
>     When running git fetch or git pull on a case insensitive filesystem
>     (e.g., default macOS), if multiple case variants of the same remote ref
>     exist (often after a case-only rename), both variant locks map to the
>     same on-disk path. When a local update is required, Git creates a lock
>     for the first variant and then attempts to lock the second, which
>     collides with the same lock file, so an “existing lock” error is
>     reported.

And the message update may help unconfusing the user who gets this
error, which is a good idea.  Thanks for working on this.

>     The underlying issue is mixed-case refs; resolve it by
>     consolidating the remote to a single-case variant and update local refs
>     accordingly.

This does not seem to match anything the patch does, though ;-)

>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2053%2Fadacosta%2Flockfile-add-case-insensitive-filesystem-note-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2053/adacosta/lockfile-add-case-insensitive-filesystem-note-v1
> Pull-Request: https://github.com/git/git/pull/2053
>
>  lockfile.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

> diff --git a/lockfile.c b/lockfile.c
> index 1d5ed01682..99a470bd3d 100644
> --- a/lockfile.c
> +++ b/lockfile.c
> @@ -156,7 +156,10 @@ void unable_to_lock_message(const char *path, int err, struct strbuf *buf)
>  		    "an editor opened by 'git commit'. Please make sure all processes\n"
>  		    "are terminated then try again. If it still fails, a git process\n"
>  		    "may have crashed in this repository earlier:\n"
> -		    "remove the file manually to continue."),
> +		    "remove the file manually to continue.\n\n"
> +		    "On case insensitive client filesystems, multiple mixed-case refs will resolve\n"
> +		    "to the same lock file, possibly causing this error. If so, ensure your remote\n"
> +		    "refs have a single case variant."),
>  			    absolute_path(path), strerror(err));

The two lines in the new part of the message seem to be longer than
usual by two words or so.  Can you line wrap to balance?

The error is about our "local" filesystem, isn't it?  If you do not
have control over what the remote does, you have no recourse.  If
using the reftable backend on the local end work around the local
filesystem's case insensitivity, that would be a better suggestion
to give that such a user can actually act on.

In any case, wouldn't it make more sense to do this change
conditionally by looking at the value of the ignore_case global
(which in turn came from the core.ignorecase setting in .git/config
when the repository was created by probing the filesystem
capabilities)?  If you get this error and you are on a case
sensitive system, the additional hints will lead the user to a
wild goose chase.

Thanks.

Add note of case insensitive client filesystems may error due to a lock on a case variant ref to more quickly identify failure in fetch/pull.

Signed-off-by: Alan Da Costa <alandacosta@gmail.com>
@adacosta adacosta force-pushed the lockfile-add-case-insensitive-filesystem-note branch from d240776 to e18054e Compare September 22, 2025 22:37
Copy link

There are issues in commit e18054e:
lockfile: add case insensitive filesystem note
Lines in the body of the commit messages should be wrapped between 60 and 76 characters.
Indented lines, and lines without whitespace, are exempt

Copy link

On the Git mailing list, Patrick Steinhardt wrote (reply to this):

On Mon, Sep 22, 2025 at 09:54:44PM +0000, Alan Da Costa via GitGitGadget wrote:
> From: Alan Da Costa <alandacosta@gmail.com>
> When running git fetch or git pull on a case insensitive filesystem
> (e.g., default macOS), if multiple case variants of the same remote ref
> exist (often after a case-only rename), both variant locks map to the
> same on-disk path. When a local update is required, Git creates a lock
> for the first variant and then attempts to lock the second, which
> collides with the same lock file, so an “existing lock” error is
> reported. The underlying issue is mixed-case refs; resolve it by
> consolidating the remote to a single-case variant and update local refs
> accordingly.

Are you aware of Karthik's recent patch series at [1]? It looks like
this addresses your exact problem in a more direct way, and the
resulting error messages that we have in that patch series also give a
bit more advice for how to handle the situation.

The patch series wasn't merged yet, but will probably be merged soon.
Could you maybe test that series and say whether it addresses your need?

Thanks!

Patrick

[1]: https://lore.kernel.org/git/20250902-587-git-fetch-1-fails-fetches-on-case-insensitive-repositories-v1-0-35e69bbb507d@gmail.com/

Copy link

User Patrick Steinhardt <ps@pks.im> has been added to the cc: list.

Copy link

On the Git mailing list, Karthik Nayak wrote (reply to this):

Patrick Steinhardt <ps@pks.im> writes:

> On Mon, Sep 22, 2025 at 09:54:44PM +0000, Alan Da Costa via GitGitGadget wrote:
>> From: Alan Da Costa <alandacosta@gmail.com>
>> When running git fetch or git pull on a case insensitive filesystem
>> (e.g., default macOS), if multiple case variants of the same remote ref
>> exist (often after a case-only rename), both variant locks map to the
>> same on-disk path. When a local update is required, Git creates a lock
>> for the first variant and then attempts to lock the second, which
>> collides with the same lock file, so an “existing lock” error is
>> reported. The underlying issue is mixed-case refs; resolve it by
>> consolidating the remote to a single-case variant and update local refs
>> accordingly.
>
> Are you aware of Karthik's recent patch series at [1]? It looks like
> this addresses your exact problem in a more direct way, and the
> resulting error messages that we have in that patch series also give a
> bit more advice for how to handle the situation.
>

Thanks for tagging me.

>
> The patch series wasn't merged yet, but will probably be merged soon.
> Could you maybe test that series and say whether it addresses your need?
>

I agree. This should ideally be fixed with my series. Do let us know if
you test it. My series also has the added advantage that it would
suggest using reftables, wherein, the user can still use
case-conflicting refs in their repository.

> Thanks!
>
> Patrick
>
> [1]: https://lore.kernel.org/git/20250902-587-git-fetch-1-fails-fetches-on-case-insensitive-repositories-v1-0-35e69bbb507d@gmail.com/

Copy link

User Karthik Nayak <karthik.188@gmail.com> has been added to the cc: list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants