Repository navigation
credential-store: accept CRLF as EOL #6425
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
Open
rimrul
wants to merge
1
commit into
git-for-windows:main
Choose a base branch
from
rimrul:credentioal-store-crlf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. This reverts c03859a, and I wonder whether we're not actually making things worse that way: We're essentially walking back a promise that we've upheld for 6 years...
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my perspective as a user, it seems both normal and reasonable for "Git for Windows" to support a credentials file with CRLF line endings, since the program is natively intended for Windows.
Also, CRLF handling seems currently to be inconsistent: CRLF credentials are considered invalid at line 146
(test_expect_success 'get: credentials with DOS line endings are invalid'), but valid at line 163(test_expect_success 'get: credentials with path and DOS line endings are valid')?!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@i80487 what you missed, though, is that we're not even talking about user-facing files, but about files that are written by Git. Some users may feel free to muck with those, and change the line endings. That's what this PR tries to accommodate. I don't think it would set a good precedent, though. Soon we'd have to add patches left and right to accommodate for all sorts of subtle inconsistencies users would introduce into Git's internal files, when it would be better to draw a hard line: Iff you want to mess with those files, you're completely on your own, we won't cover up your mistakes.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dscho: As a software engineer, I fully understand that you may not want to support every possible case that users might introduce.
As an end user of "git-for-windows", please note that
.gitconfigand.git-credentialsare text files stored in the home directory. They’re not internal Git files stored in a.gitfolder, but configuration and credential files. As with many other applications, it seems to me both legitimate and reasonable to be able to edit them (while following the syntax) with a text editor rather than having to use Git commands.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@i80487 I understand your desire, but you're mixing two concepts here.
.gitconfigis supposed to be edited by the user, typically using thegit configcommand. The.git-credentialsfile is in a very different category, it is the backing file ofgit-credential--store, and as such it totally is not meant to be edited by users, certainly not directly via a text editor. Just because you can does not mean that it is a good idea.Take for example packfiles. You can edit
.packfiles with a hex editor, it's just really a terrible idea. You might corrupt it in ways that Git does not expect. The end result is that it no longer works as you want, and the only reason for that is that you edited the file manually, and you messed up.It's the same, really, when you edit the
.git-credentialsfile. You have to abide by the format Git expects. And if you save with CR/LF line endings, well, there you go, you messed up, the file is no longer in a format Git handles because it did not expect you to mess it up. It expected that file to be under its own control. And you broke that contract.I don't think that it is a good idea to change Git in a way that it tries to work around such mess-ups. That would just set this awful precedent where I have to spend even more time on addressing problems that aren't caused by bugs in Git, but purely by users doing something that they shouldn't have done in the first place, because it's outside of what is supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dscho : I understand and respect your point of view. I appreciate you taking the time to review my request and discuss it with me. Feel free to close this pull request and close the issue as well.