threads / discuss / 60507

Declutter the home directory

Subject: Declutter the home directory

## tl;dr

2 messages between Nov 12, 2023 and Nov 12, 2023.

replies: 1people: 2as markdown or json

Félix Piédallu· Nov 12, 2023, 12:10 UTC · lore

Hi, I'm new on this mailing list so please tell me if the subject was already discussed.

The Freedesktop XDG Base Directory specification (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) aims to declutter the home directory by moving files where they should be more logically located. Here i'll be talking about some directories:

* $XDG_CACHE_HOME, that defaults to the well-known $HOME/.cache
* $XDG_CONFIG_HOME, that defaults to the also well known $HOME/.config
* $XDG_RUNTIME_DIR, that should contain non-essential runtime files
   such as socket files
For now 4 kind of files are put in the $HOME directory by git:
* .gitconfig | .config/git/config
   it defaults to .gitconfig
* .git-credentials | .config/git/credentials from the credential-store
   it also defaults to .git-credentials
* .cache/git/credentials | .git-credential-cache/ from credential-cache
   this one defaults to .cache/git/credentials/
* .git-fsmonitor-%s for Darwin file system monitor.
I have 3 propositions:
## Move runtimes files to $XDG_RUNTIME_DIR
* .cache/git/credential/ -> $XDG_RUNTIME_DIR/git/credential/
* .git-fsmonitor-%s -> $XDG_RUNTIME_DIR/git/fsmonitor/%s

Those file shall be deleted at the end of the user session, so this is the good place to store them.

## Move ~/.config/git/credentials to ~/.cache/git/credentials

Indeed this might contain sensitive information that some users don't want to be backed up or synchronized. A possibility would be to read ~/.cache/git/credentials, ~/.config/git/credentials, ~/.git-credentials, and to use the first existing one.

## Default to XDG paths instead of home directory

It would just swap the priority of the two possible paths. It would also only impact new installations as, if ~/.gitconfig exists, it would keep being used.

The goal of those propositions is to declutter the home directory, and ease the cleanup, backup and synchronisation of user settings.

Thanks for reading me.
Félix Piédallu
Dragan Simic· Nov 12, 2023, 13:39 UTC · re: Félix Piédallu · lore

Re: Declutter the home directory

On 2023-11-12 13:10, Félix Piédallu wrote:
Show 5 quoted lines
> ## Default to XDG paths instead of home directory
> 
> It would just swap the priority of the two possible paths. It would
> also only impact new installations as, if ~/.gitconfig exists, it
> would keep being used.

Quite frankly, some configuration files should remain in $HOME, and ~/.gitconfig is IMHO one of those. It's used very frequently, not only directly, but also while discussing or explaining various configuration features or issues. Thus, moving it somewhere else would only make things more complicated and worse.

IOW, I think that the order/priority shouldn't be changed.

← back to recent threads