emacs.g icon indicating copy to clipboard operation
emacs.g copied to clipboard

Failed to bootstrap when cloning this repo as a git submodule

Open A7R7 opened this issue 1 year ago • 3 comments

I cloned the repo as a submodule of my dotfiles for independency. But it cannot be bootstrapted when cloning as a git submodule, and that's because in a git submodule, .git isn't actually a dir, but a file with content like

gitdir: ../.git/modules/emacs

I looked into the code and found a lot of .git got treated as dir, and they usually appear after --separate-git-dir.

I guess the reason that drones got cloned with --separate-git-dir but not in the usual submodule style is to be able to checkout its branch.

If I replace all the .git with ../.git/modules/emacs, will it work?

A7R7 avatar Dec 02 '23 16:12 A7R7

I did not touch .git words but deleted the .git file and symlinked ../.git/modules/emacs to .git and after that everything seems to work flawlessly, wondering why .git gets designed like this in git submodule.

A7R7 avatar Dec 02 '23 16:12 A7R7

I looked into the code and found a lot of .git got treated as dir, and they usually appear after --separate-git-dir.

I guess the reason that drones got cloned with --separate-git-dir but not in the usual submodule style is to be able to checkout its branch.

The code in borg that involves --separate-git-dir converts repositories that were previously cloned using git clone, borg-clone, ... to move the git data to ~/.config/emacs/.git/modules/PKG/, where git submodule and bort-assimilate would have put them, had they been used to clone the repository.

I.e., the drones get cloned "as usual for git modules", if you use borg-assimilate (which implies --separate-git-dir), or the get converted after the fact (which involves using --separate-git-dir). The end result is the same.

Where this seems to go wrong is that the cleanup code assumes that ~/.config/emacs/.git itself is a directory.

I'll look into that at some point, but am rather busy right now.

You might want to consider using the same repository for your emacs configuration and your other dotfiles. I.e., don't make ~/.config/emacs itself a repository, add the ~/.config/emacs/lib/PKG repositories as modules of the ~/ repository. You will have to go through the "Bootstrapping from scratch" steps and make some adjustments to do this. Others have done that before I believe. You might be able to find something about it in older issues.

I deleted .git and symlinked ../.git/modules/emacs to .git and after that everything seems to work flawlessly, wondering why .git gets designed like this in git submodule.

I thought you did that intentionally:

I cloned the repo as a submodule of my dotfiles for independency.

tarsius avatar Dec 02 '23 23:12 tarsius

Thank you for your prompt reply! Since symlinking ../.git/modules/emacs to .git actually works™,I may keep on doing this. It is just a little troublesome everytime I or someone deploy my dotfiles, but a makefile should automate all these procedures.

A7R7 avatar Dec 03 '23 06:12 A7R7