0

When using Emacs' built-in project.el functionality with git repositories containing submodules over Tramp, there's a significant performance issue caused by repeated, unsuccessful attempts to access .gitmodules files. This results in noticeable delays in responsiveness for almost every action within the project.

Steps to Reproduce:

  1. Create a test repository with a submodule:
cd && mkdir tmp && cd tmp git init main_repo git init sub_repo touch sub_file git add sub_file git commit -m "Initial commit" cd ../main_repo git submodule add $(whoami)@$HOSTNAME:/home/$(whoami)/tmp/sub_repo git submodule update --init --recursive 
  1. Launch Emacs with no init file:
emacs -q 
  1. Open the project directory using M-x project-switch-project, then type ... RET to get the prompt to select a directory for the project.
  2. Enter /ssh:<user>@<hostname>:~/tmp/main_repo RET for the directory path (Provide your password when/if prompted).
  3. Open a dired view of the project root: f RET.
  4. Switch to C-x b *Messages* to examine the messages buffer.
  5. In the *Messages* buffer, you (hopefully) will see:
Tramp: Inserting ‘/ssh:<user>@<hostname>:/home/<user>/tmp/main_repo/.gitmodules’...done Tramp: Inserting ‘/ssh:<user>@<hostname>:/home/<user>/tmp/main_repo/sub_repo/.gitmodules’...failed File is missing: /ssh:<user>@<hostname>:/home/<user>/tmp/main_repo/sub_repo/.gitmodules [2 times] 

Tramp repeatedly attempts to load .gitmodules files even for submodules that don't require them. It may have not been noticeable in this single-submodule, localhost example but on an actual remote machine with numerous submodules, this causes significant lag and hangs with almost every action (e.g., finding files with C-x p f, navigating dired, saving/reverting buffers).

My Emacs is built with default settings from source:

This is GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2025-09-17 
  • project.el version: 0.11.1 (Built-In)
  • tramp.el version: 0 (Built-In)

but I am fairly certain this was also the case with Emacs 29.4 but previously attributed this issue to my configuration.

Is this a known issue, a bug, or is there a configuration option to disable or mitigate this behavior?

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.