Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to AppData if XDG_CONFIG_HOME is unset #5030

Merged
merged 1 commit into from
Jul 4, 2024
Merged

Fallback to AppData if XDG_CONFIG_HOME is unset #5030

merged 1 commit into from
Jul 4, 2024

Conversation

ariellourenco
Copy link

@ariellourenco
Copy link
Author

Hi @dscho ,

This is the initial PR to add support for AppData if the XDG_CONFIG is unset. Unfortunately, I wasn't able to move the platform-dependent code to compat\ folder, could you point me to the right direction on how to achieve it? Moreover,
do you think this change worth a functional test? If so, where it should be placed? Should I document this new behavior some where?

Thanks in advance for your guidance.

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably okay to keep this in a WIN32-specific code block. If the reviewers on the Git mailing list take offense, we can still change it then.

However, the commit messages need a sign-off.

Also, the second commit fixes a bug introduced in the first one, and the reviewers on the Git mailing list regularly object to introducing a known bug in that way, asking contributors to "squash the commits" instead.

Also, please avoid undescriptive one-liner commit messages. Instead follow the guidance in https://github.blog/2022-06-30-write-better-commits-build-better-projects/ to improve them, in particular with a strong focus on this part:

  What you’re doing Why you’re doing it
High-level (strategic) Intent (what does this accomplish?) Context (why does the code do what it does now?)
Low-level (tactical) Implementation (what did you do to accomplish your goal?) Justification (why is this change being made?)

path.c Outdated Show resolved Hide resolved
In order to be a better Windows citizenship, Git should
save its configuration files on AppData folder. This can
enables git configuration files be replicated between machines
using the same Microsoft account logon which would reduce the
friction of setting up Git on new systems. Therefore, if
%APPDATA%\Git\config exists, we use it; otherwise
$HOME/.config/git/config is used.

Signed-off-by: Ariel Lourenco <[email protected]>
@dscho
Copy link
Member

dscho commented Jul 4, 2024

/add relnote feature git config respects two user-wide configs: .gitconfig in the home directory, and .config/git/config. Since the latter isn't a Windows-native directory, Git for Windows now looks for Git/config in the AppData directory, unless .config/git/config exists.

The workflow run was started

github-actions bot pushed a commit to git-for-windows/build-extra that referenced this pull request Jul 4, 2024
`git config` [respects two user-wide
configs](https://git-scm.com/docs/git-config#FILES): `.gitconfig` in the
home directory, and `.config/git/config`. Since the latter isn't a
Windows-native directory, [Git for Windows now looks for `Git/config` in
the `AppData`
directory](git-for-windows/git#5030), unless
`.config/git/config` exists.

Signed-off-by: gitforwindowshelper[bot] <[email protected]>
@dscho dscho merged commit 15e18f2 into git-for-windows:main Jul 4, 2024
44 checks passed
@dscho dscho added this to the Next release milestone Jul 4, 2024
@dscho
Copy link
Member

dscho commented Jul 4, 2024

Thank you @ariellourenco for your contribution!

@ariellourenco
Copy link
Author

My pleasure @dscho

@ariellourenco ariellourenco deleted the fallback-to-appdata branch July 4, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants