TheLocehiliosan / yadm

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

`yadm config` stores settings in git's config file, not yadm's config file #438

Closed jacktose closed 1 year ago

jacktose commented 1 year ago

This question is about

Describe your question

A long time ago (yadm v1 probably), I set local.class and local.hostname. Those settings are in $HOME/.local/share/yadm/repo.git/config and there is no $HOME/.config/yadm/config:

$ ls -a "$HOME/.config/yadm/"
./  ../  alt/  bootstrap  encrypt

$ cat "$HOME/.config/yadm/config"
cat: /usr/lusers/jacktose/.config/yadm/config: No such file or directory

$ cat "$HOME/.local/share/yadm/repo.git/config"
...
[local]
        class = work
        hostname = port
...

If I change or add a value, it changes the git config file:

$ yadm config local.hostname foo
$ yadm config local.user yourstruly

$ cat "$HOME/.config/yadm/config"
cat: /usr/lusers/jacktose/.config/yadm/config: No such file or directory

$ cat "$HOME/.local/share/yadm/repo.git/config"
...
[local]
        class = work
        hostname = foo
        user = yourstruly
...

I can't find anything in the docs/manual describing that behavior. Is something broken? Should I somehow move those settings to $HOME/.config/yadm/config?

jacktose commented 1 year ago

It seems this is true in a cleaner situation, too: a recently-created WSL instance where I cloned the same yadm repo and haven't set any yadm config settings.

No yadm config file:

$ yadm config -l
fatal: unable to read config file '/home/jack/.config/yadm/config': No such file or directory
$ cat "$HOME/.config/yadm/config"
cat: /home/jack/.config/yadm/config: No such file or directory
$ ls -a "$HOME/.config/yadm/"
./  ../  alt/  bootstrap  encrypt

No yadm config settings in git config file:

$ cat "$HOME/.local/share/yadm/repo.git/config"
# (no [local] section at all)

New setting is stored in git config file:

$ yadm config local.user yourstruly
$ yadm config local.user
yourstruly
$ cat "$HOME/.local/share/yadm/repo.git/config"
...
[local]
        user = yourstruly

yadm did not create config file:

$ cat "$HOME/.config/yadm/config"
cat: /home/jack/.config/yadm/config: No such file or directory

and weirdly (different from first example), cannot list config from git config file:

$ yadm config -l
fatal: unable to read config file '/home/jack/.config/yadm/config': No such file or directory
TheLocehiliosan commented 1 year ago

There are two sets of supported configurations.

The yadm.* configs, which are stored in .config/yadm/config. For example yadm.cipher. These can be viewed with yadm config -l.

The local.* configs, which are stored in the local yadm repo's config .local/share/yadm/repo.git/config. For example, local.class. These can be viewed with yadm gitconfig -l.

The local.* variables are meant to be locally defined on a single host, so they are not stored in the global yadm config. Each time yadm is cloned the values for that host must be set manually, or via a bootstrap.

This is noted in the man page CONFIGURATION section which reads

The following five "local" configurations are not stored in the $HOME/.config/yadm/config, they are stored in the local repository.

Does this help clear up confusion?

jacktose commented 1 year ago

Ah, thank you! Sorry I missed that line in the docs.