about summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-12-02 12:38:56 +0800
committerGitHub <noreply@github.com>2024-12-02 12:38:56 +0800
commitc207d2f2882bf55bc41df8dbc64af90e1367b2eb (patch)
treedec5b74ccd1d70d3b520b6ef87d3bed0816eaf05 /src/doc/rustc-dev-guide
parent718d43546483f4356b20ae88e7b55415a9a4dcf6 (diff)
downloadrust-c207d2f2882bf55bc41df8dbc64af90e1367b2eb.tar.gz
rust-c207d2f2882bf55bc41df8dbc64af90e1367b2eb.zip
Explain how to deal with exploded git submodules (#2152)
Diffstat (limited to 'src/doc/rustc-dev-guide')
-rw-r--r--src/doc/rustc-dev-guide/src/git.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/src/git.md b/src/doc/rustc-dev-guide/src/git.md
index 90dbc3fb1b5..75e9d1f049b 100644
--- a/src/doc/rustc-dev-guide/src/git.md
+++ b/src/doc/rustc-dev-guide/src/git.md
@@ -597,6 +597,27 @@ $ git submodule foreach git reset --hard
 
 and then try `git submodule update` again.
 
+Unfortunately sometimes your local git submodules configuration can become
+completely messed up for some reason.
+
+### Overcoming `fatal: not a git repository: <submodule>/../../.git/modules/<submodule>`
+
+Sometimes, for some forsaken reason, you might run into
+
+```text
+fatal: not a git repository: src/gcc/../../.git/modules/src/gcc
+```
+
+In this situation, for the given submodule path, i.e. `<submodule_path> =
+src/gcc` in this example, you need to:
+
+1. `rm -rf <submodule_path>/.git`
+2. `rm -rf .git/modules/<submodule_path>/config`
+3. `rm -rf .gitconfig.lock` if somehow the `.gitconfig` lock is orphaned.
+
+Then do something like `./x fmt` to have bootstrap manage the submodule
+checkouts for you.
+
 ## Ignoring commits during `git blame`
 
 Some commits contain large reformatting changes that don't otherwise change functionality. They can