{"thread":{"id":"38817","subject":"What is XDG_CONFIG_HOME for exactly?","startedAt":"2015-03-15T23:37:39Z","lastAt":"2015-03-16T09:31:55Z","messageCount":4,"participants":["Robert Dailey","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"257758","messageId":"CAHd499CmxwGJeW6gMARhc+cT+r3TK98m+LyyS+eCFXz8qKHrFw@mail.gmail.com","threadId":"38817","inReplyTo":null,"subject":"What is XDG_CONFIG_HOME for exactly?","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-03-15T23:37:39Z","receivedAt":"2015-03-15T23:37:39Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"My understanding is that git reads the priority of configuration as follows:\n\n1. <local_repo>/.git/config\n2. $HOME/.gitconfig\n3. $XDG_CONFIG_HOME/git/config\n4. system level git config (not sure exactly where this is; not\nrelevant to me on Windows)\n\nI have a .gitconfig in Dropbox that I symlink to my home directory on\ndifferent platforms. Specifically, I share this gitconfig across\nCygwin/msys on Windows and Ubuntu.\n\nIf I can use XDG_CONFIG_HOME to leverage platform-specific settings,\nI'd be able to keep platform-agnostic settings in my $HOME/.gitconfig\nand put platform-specific settings in $XDG_CONFIG_HOME/git/config and\nsimply give XDG_CONFIG_HOME a different name on different platforms.\n\nIs this what it was designed for? If not, what would be the best\napproach for this? I was thinking of contributing a patch that would\nlet you specify the name of your git config in the home directory, but\nI'm not sure if that is necessary. Something like this:\n\n$HOME/$GIT_CONFIG_FILENAME, where GIT_CONFIG_FILENAME defaults to\n\".gitconfig\" if it is not set or empty.\n"},{"id":"257760","messageId":"CAHd499AGHgBECH9t_EtkwLx7VCx3yVnDS27PteF3zF1xSAG8Yg@mail.gmail.com","threadId":"38817","inReplyTo":"CAHd499CmxwGJeW6gMARhc+cT+r3TK98m+LyyS+eCFXz8qKHrFw@mail.gmail.com","subject":"Re: What is XDG_CONFIG_HOME for exactly?","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-03-15T23:50:34Z","receivedAt":"2015-03-15T23:50:34Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"As a follow-up, I tested the following in my .bashrc:\n\n\n# Utilize different GIT settings based on platform\nif [[ $OSTYPE == 'msys' || $OSTYPE == 'cygwin' ]]; then\n    echo 'Using WINDOWS specific git settings'\n    export XDG_CONFIG_HOME=.config-windows\nelse\n    echo 'Using LINUX specific git settings'\n    export XDG_CONFIG_HOME=.config-linux\nfi\n\n\nThis seems to work nicely!! I share my $HOME directory (located in\ndropbox) across all platforms so this helps me keep a consistent\nenvironment across all my machines with zero effort.\n\nOn Sun, Mar 15, 2015 at 6:37 PM, Robert Dailey <rcdailey.lists@gmail.com> wrote:\n> My understanding is that git reads the priority of configuration as follows:\n>\n> 1. <local_repo>/.git/config\n> 2. $HOME/.gitconfig\n> 3. $XDG_CONFIG_HOME/git/config\n> 4. system level git config (not sure exactly where this is; not\n> relevant to me on Windows)\n>\n> I have a .gitconfig in Dropbox that I symlink to my home directory on\n> different platforms. Specifically, I share this gitconfig across\n> Cygwin/msys on Windows and Ubuntu.\n>\n> If I can use XDG_CONFIG_HOME to leverage platform-specific settings,\n> I'd be able to keep platform-agnostic settings in my $HOME/.gitconfig\n> and put platform-specific settings in $XDG_CONFIG_HOME/git/config and\n> simply give XDG_CONFIG_HOME a different name on different platforms.\n>\n> Is this what it was designed for? If not, what would be the best\n> approach for this? I was thinking of contributing a patch that would\n> let you specify the name of your git config in the home directory, but\n> I'm not sure if that is necessary. Something like this:\n>\n> $HOME/$GIT_CONFIG_FILENAME, where GIT_CONFIG_FILENAME defaults to\n> \".gitconfig\" if it is not set or empty.\n"},{"id":"257761","messageId":"CAHd499CPevdk5E-m2U5rWjiaV+zz74+Ev6hvpeLoieVPb8TFtg@mail.gmail.com","threadId":"38817","inReplyTo":"CAHd499AGHgBECH9t_EtkwLx7VCx3yVnDS27PteF3zF1xSAG8Yg@mail.gmail.com","subject":"Re: What is XDG_CONFIG_HOME for exactly?","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-03-15T23:59:21Z","receivedAt":"2015-03-15T23:59:21Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"Sorry for the continuous updates... it seems I spoke too soon. This\nworks until you CD into a repository, then none of the settings are\naccessible. So yeah, basically I need to make sure I'm using this as\nintended... I still don't understand the purpose of the XDG thing.\n\nOn Sun, Mar 15, 2015 at 6:50 PM, Robert Dailey <rcdailey.lists@gmail.com> wrote:\n> As a follow-up, I tested the following in my .bashrc:\n>\n>\n> # Utilize different GIT settings based on platform\n> if [[ $OSTYPE == 'msys' || $OSTYPE == 'cygwin' ]]; then\n>     echo 'Using WINDOWS specific git settings'\n>     export XDG_CONFIG_HOME=.config-windows\n> else\n>     echo 'Using LINUX specific git settings'\n>     export XDG_CONFIG_HOME=.config-linux\n> fi\n>\n>\n> This seems to work nicely!! I share my $HOME directory (located in\n> dropbox) across all platforms so this helps me keep a consistent\n> environment across all my machines with zero effort.\n>\n> On Sun, Mar 15, 2015 at 6:37 PM, Robert Dailey <rcdailey.lists@gmail.com> wrote:\n>> My understanding is that git reads the priority of configuration as follows:\n>>\n>> 1. <local_repo>/.git/config\n>> 2. $HOME/.gitconfig\n>> 3. $XDG_CONFIG_HOME/git/config\n>> 4. system level git config (not sure exactly where this is; not\n>> relevant to me on Windows)\n>>\n>> I have a .gitconfig in Dropbox that I symlink to my home directory on\n>> different platforms. Specifically, I share this gitconfig across\n>> Cygwin/msys on Windows and Ubuntu.\n>>\n>> If I can use XDG_CONFIG_HOME to leverage platform-specific settings,\n>> I'd be able to keep platform-agnostic settings in my $HOME/.gitconfig\n>> and put platform-specific settings in $XDG_CONFIG_HOME/git/config and\n>> simply give XDG_CONFIG_HOME a different name on different platforms.\n>>\n>> Is this what it was designed for? If not, what would be the best\n>> approach for this? I was thinking of contributing a patch that would\n>> let you specify the name of your git config in the home directory, but\n>> I'm not sure if that is necessary. Something like this:\n>>\n>> $HOME/$GIT_CONFIG_FILENAME, where GIT_CONFIG_FILENAME defaults to\n>> \".gitconfig\" if it is not set or empty.\n"},{"id":"257777","messageId":"vpqvbi1qodw.fsf@anie.imag.fr","threadId":"38817","inReplyTo":"CAHd499AGHgBECH9t_EtkwLx7VCx3yVnDS27PteF3zF1xSAG8Yg@mail.gmail.com","subject":"Re: What is XDG_CONFIG_HOME for exactly?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-03-16T09:31:55Z","receivedAt":"2015-03-16T09:31:55Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"> On Sun, Mar 15, 2015 at 6:37 PM, Robert Dailey <rcdailey.lists@gmail.com> wrote:\n>> My understanding is that git reads the priority of configuration as follows:\n>>\n>> 1. <local_repo>/.git/config\n>> 2. $HOME/.gitconfig\n>> 3. $XDG_CONFIG_HOME/git/config\n\n$HOME/.gitconfig is the traditional Unix location for config files. It\nwas the only per-user config files in early versions of Git.\n\n$XDG_CONFIG_HOME/git/config is the location following freedesktop's XDG\nstandard. It has several advantages (you can version and/or share\nindividual $XDG_CONFIG_HOME/git/ as a whole directory, while it's much\nharder to version all ~/.git* files individually for example).\n\nYou typically want to use either one or the other.\n\n>> 4. system level git config (not sure exactly where this is; not\n>> relevant to me on Windows)\n\nThis is relevant if you use a shared machine and your sysadmin wants to\nhave the same configuration for all users.\n\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\nRobert Dailey <rcdailey.lists@gmail.com> writes:\n\n> As a follow-up, I tested the following in my .bashrc:\n>\n>\n> # Utilize different GIT settings based on platform\n> if [[ $OSTYPE == 'msys' || $OSTYPE == 'cygwin' ]]; then\n>     echo 'Using WINDOWS specific git settings'\n>     export XDG_CONFIG_HOME=.config-windows\n\nYou need an absolute directory here:\n\nexport XDG_CONFIG_HOME=$HOME/.config-windows\n\nThen, I'd suggest that $XDG_CONFIG_HOME/git/config contains a\n\n[include]\n    path = ../../.config-shared/git/config\n\nso that you can factor out common portions of your config file into\n.config-shared/git/config and keep machine-specific portions in\n~/.config-{windows,linux}.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}