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

Run git config instead of reading config file manually #639

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Sep 4, 2024

I don't think there's a good reason to read the config file directly. Going through the CLI is easier and safer.

ref: #638 (comment)

Copy link
Contributor

@ysbaddaden ysbaddaden left a comment

Choose a reason for hiding this comment

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

Oh my, why did I choose to read the config file 😱

@straight-shoota straight-shoota added this to the 0.19.0 milestone Sep 4, 2024
return true if line =~ /mirror\s*=\s*true/
end
false
capture("git config --get-regexp 'remote\\..+\\.mirror'").each_line.any?(&.==("true"))
end

private def origin_url

Choose a reason for hiding this comment

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

Do you think we can do something similar to origin_url then to fix the problem related to #628?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think this should work similarly.

@straight-shoota straight-shoota merged commit e8fe2bd into crystal-lang:master Sep 6, 2024
7 of 8 checks passed
@straight-shoota straight-shoota deleted the refactor/git-config-replace-reading-file branch September 6, 2024 06:28
@straight-shoota
Copy link
Member Author

straight-shoota commented Sep 18, 2024

The CI failure due to #640 masked another failure. This patch seems to be broken on Windows.

E: Failed git config --get-regexp 'remote..+.mirror'.

The reason is that the exit code of git config --get-regexp seems to be 1 if the expression did not match. Not sure why this doesn't fail on Linux or MacOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants