emacscollective / emacs.g

The Emacs Collective
ISC License
88 stars 49 forks source link

Failed to bootstrap when cloning this repo as a git submodule #30

Closed A7R7 closed 2 months ago

A7R7 commented 10 months ago

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 commented 10 months ago

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.

tarsius commented 10 months ago

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.

A7R7 commented 10 months ago

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.

tarsius commented 2 months ago

Closing in favor of https://github.com/emacscollective/borg/issues/154.

tarsius commented 2 months ago

This is supported now.