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

Fix typo in bash credentials helper example #1934

Closed
wants to merge 1 commit into from

Conversation

JoshuaBehrens
Copy link

Changes

There is a code example, that is not an executable example:

image

After the change it should look like this

image

Context

I am looking to implement a custom git credentials helper and did not find a good example. I am not sure though, whether the example shouldn't even be

! if("$1" == 'get') { echo "password=s3cre7"; };

@JoshuaBehrens JoshuaBehrens changed the title Fix typo in bash helper example Fix typo in bash credentials helper example Dec 15, 2024
@dscho
Copy link
Member

dscho commented Dec 16, 2024

The original is actually correct. It defines a shell function and then immediately executes it.

The code after the change is incorrect because it pretends that it's an if construct. But if constructs in shell don't take parentheses or empty conditionals, and it's not executed at all, it gives a syntax error, or at least it should.

In any case, this change would need to be made in the ProGit book repository, if it was correct, not in the git-scm.com repository.

@dscho dscho closed this Dec 16, 2024
@dscho
Copy link
Member

dscho commented Dec 16, 2024

@JoshuaBehrens JoshuaBehrens deleted the patch-1 branch December 16, 2024 12:31
@JoshuaBehrens
Copy link
Author

Hi @dscho thank you for point it out. Must've been a misread that it looked like a misplaced copy-pasta and would've been an if. Thank you for the guidance and the helpful explanations! 👍 ❤️

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