git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Declutter the home directory

From
FPFélix Piédallu <felix@piedallu.me>
Date
Nov 12, 2023, 12:10 UTC
Message-ID
<cb89d863-12d4-412b-a25b-9eedce996708@piedallu.me>

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
Next: Dragan Simic
Message 1 of 2 in “Declutter the home directory”
  1. Félix PiédalluNov 12, 2023
  2. Dragan SimicNov 12, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.