-
Notifications
You must be signed in to change notification settings - Fork 124
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
Use POSIX strict mode #304
base: main
Are you sure you want to change the base?
Conversation
Fixes #303 Signed-off-by: Richard Hartmann <[email protected]>
55158a1
to
4f27e5a
Compare
I am unsure if Line 704 in 4f013c3
${VCSH_REPO_NAME-} or if that's overly brittle given what we're trying to achieve with strict mode. We might want to add a variable which explicitly tells us if VCSH_REPO_NAME should be set instead of transporting this information implicitly by the variable itself being set, or not. I am not certain if that's more resilient in the end, though.
|
`set -o nounset` made it clear that my flow control is really really bad and relies heavily on $VCSH_REPO_NAME transporting information both through its value and by being set or not. That will need to be cleaned up. NB: It might be an option to set it to empty as a global and leave it as that, but that seems icky and brittle. Signed-off-by: Richard Hartmann <[email protected]>
@@ -735,11 +742,13 @@ VCSH_COMMAND=$(echo "$VCSH_COMMAND" | @SED@ 's/-/_/g'); export VCSH_COMMAND | |||
|
|||
# Source repo-specific configuration file | |||
# shellcheck source=/dev/null | |||
[ -r "$XDG_CONFIG_HOME/vcsh/config.d/$VCSH_REPO_NAME" ] \ | |||
# TODO: And we rely on $VCSH_REPO_NAME implictly again | |||
[ -r "$XDG_CONFIG_HOME/vcsh/config.d/${VCSH_REPO_NAME-}" ] \ |
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.
This will only suceed by a somewhat odd side effect, -r
tests specifically for files not directories so it will fail if the values is unset and the path is only to the directory. While the result is correct, the code logic is pretty opaque.
As the assorted comments here note, the active repo(s) name handling should probably be overhauled entirely.
Closes #303.