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(shell): double quote params #824

Merged
merged 4 commits into from Jan 27, 2021
Merged

fix(shell): double quote params #824

merged 4 commits into from Jan 27, 2021

Conversation

@dargmuesli
Copy link
Contributor

@dargmuesli dargmuesli commented Dec 7, 2020

I've set test/default.sh's shebang to bash because echo -e is used in this file.

@typicode
Copy link
Owner

@typicode typicode commented Dec 7, 2020

Thanks for the PR.
What would be the use case for symlinked hooks?

@dargmuesli
Copy link
Contributor Author

@dargmuesli dargmuesli commented Dec 7, 2020

Any application that parses the git hooks directory itself without respecting a custom directory set through git config, like GitKraken for example. I suggested respecting the config setting to them earlier today, but until then the many users of GitKraken won't see husky v5 hooks executed as long as they don't add symlinks to the default git hook directory.

@dargmuesli
Copy link
Contributor Author

@dargmuesli dargmuesli commented Dec 7, 2020

Why is the CI failing btw? :0

@dargmuesli
Copy link
Contributor Author

@dargmuesli dargmuesli commented Jan 11, 2021

I resolved the merge conflicts. @typicode what's your status on this PR? :)

@typicode
Copy link
Owner

@typicode typicode commented Jan 26, 2021

Hmm, I'd prefer to keep the script as it is and not rely on readlink. I'd rather not have fixes for external tools in husky.

However, if users want to edit their pre-commit hook to handle specifically some tools, they can edit this line manually.

As for the rest LGTM, good catch on the "$0" 👍

.husky/commit-msg Show resolved Hide resolved
scripts/pre-commit Show resolved Hide resolved
@@ -15,7 +15,12 @@ function createHookFile(file: string, cmd: string) {
throw new Error(`${file} already exists`)
}

const data = ['#!/bin/sh', '. "$(dirname $0)/_/husky.sh"', '', cmd].join('\n')
const data = [

This comment has been minimized.

@typicode

typicode Jan 26, 2021
Owner

Suggested change
const data = [
const data = ['#!/bin/sh', '. "$(dirname "$0")/_/husky.sh"', '', cmd].join('\n')

This comment has been minimized.

@dargmuesli

dargmuesli Jan 26, 2021
Author Contributor

Done, except for the additional indentation (?) :)

@@ -1,4 +1,4 @@
. $(dirname $0)/_functions.sh
. $(dirname "$0")/_functions.sh

This comment has been minimized.

@typicode

typicode Jan 26, 2021
Owner

👍 could you change test/config-dir.sh too?

This comment has been minimized.

@dargmuesli

dargmuesli Jan 26, 2021
Author Contributor

Done.

@@ -1,4 +1,7 @@
. $(dirname $0)/_functions.sh
#!/bin/bash

This comment has been minimized.

@typicode

typicode Jan 26, 2021
Owner

I think the shebang can be removed since these scripts are not executable.

This comment has been minimized.

@dargmuesli

dargmuesli Jan 26, 2021
Author Contributor

Replaced that with the shellcheck comment.

@dargmuesli
Copy link
Contributor Author

@dargmuesli dargmuesli commented Jan 26, 2021

I'd rather not have fixes for external tools in husky.

I don't really see it as a fix for external tools but as broadened functionality for husky even if the "fix" happened to be the reason for this PR.

Copy link
Owner

@typicode typicode left a comment

Thanks! :)

This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants