TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
4.91k stars 176 forks source link

yadm submodule init not work (my work tree is not $HOME) #459

Closed dyf991645 closed 1 year ago

dyf991645 commented 1 year ago

Describe the bug

Nothing happened after I exec yadm submodule init. My work tree is not $HOME, since I am running yadm in unraid which $HOME will not been persist.

To reproduce

Steps to reproduce the behavior:

$ yadm clone -w /mnt/user/system/home https://xxx@github.com/dyf991645/dotfiles.git
Cloning into 'repo.git'...
remote: Enumerating objects: 1813, done.
remote: Counting objects: 100% (281/281), done.
remote: Compressing objects: 100% (176/176), done.
remote: Total 1813 (delta 103), reused 196 (delta 79), pack-reused 1532
Receiving objects: 100% (1813/1813), 12.92 MiB | 2.26 MiB/s, done.
Resolving deltas: 100% (690/690), done.
Found /mnt/user/system/home/.config/yadm/bootstrap
It appears that a bootstrap program exists.
Would you like to execute it now? (y/n)
n

$ env | grep XDG
XDG_DATA_HOME=/mnt/user/system/home/.local/share
XDG_CONFIG_HOME=/mnt/user/system/home/.config

$ yadm rev-parse --show-toplevel
/mnt/user/system/home

$ cat .gitmodules
[submodule ".oh-my-zsh"]
    path = .oh-my-zsh
    url = git@github.com:dyf991645/oh-my-zsh.git
[submodule ".vim_runtime"]
    path = .vim_runtime
    url = https://github.com/dyf991645/vimrc.git

$ yadm submodule init

$ cat .local/share/yadm/repo.git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    sharedrepository = 0600
    worktree = /mnt/user/system/home
[receive]
    denyNonFastforwards = true
[remote "origin"]
    url = https://xxx@github.com/dyf991645/dotfiles.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[status]
    showUntrackedFiles = no
[yadm]
    managed = true

Expected behavior

make submodule work

Environment

TheLocehiliosan commented 1 year ago

I just tested using submodules myself, with an alternate worktree as you've suggested and with $HOME unset, but the submodule init works for me (provided I run yadm submodule init from within the alternate worktree).

Are you receiving a particular error message? I don't see one in the info above, and it sort-of looks like zero output from running init, is that correct?

dyf991645 commented 1 year ago

I don't know why my submodule's folder is not in the repo no longer, after I readd them to the repo, it works fine.

Thanks.