Skip to content

Fix "No files specified and not in a git repo" error on older bash versions#49

Merged
alphapapa merged 3 commits intoalphapapa:masterfrom
bcc32:fix-empty-project-files-on-older-bash
Jul 10, 2024
Merged

Fix "No files specified and not in a git repo" error on older bash versions#49
alphapapa merged 3 commits intoalphapapa:masterfrom
bcc32:fix-empty-project-files-on-older-bash

Conversation

@bcc32
Copy link
Contributor

@bcc32 bcc32 commented Jul 8, 2024

On bash-3.2 and older, this code passes a single empty "excludes" argument to
git ls-files instead of no arguments, which causes it to print no
output (and the error is swallowed by 2>/dev/null):

local excludes

<snip>

git ls-files ... "${excludes[@]}"

Since macOS runners on GitHub Actions have this old version of bash, I
personally think it would be convenient to fix this incompatibility
here, rather than forcing the CI workflows to install a new bash
version.

bcc32 added 2 commits July 8, 2024 16:08
In older versions of bash (such as on macOS GitHub runners),
"${excludes[@]}" expands to a single empty argument (rather than no
arguments as intended), if it is declared as local without giving it a
value.
@alphapapa alphapapa merged commit dc9921e into alphapapa:master Jul 10, 2024
@alphapapa
Copy link
Owner

Thanks!

@alphapapa alphapapa added this to the 0.8 milestone Jul 10, 2024
@bcc32 bcc32 deleted the fix-empty-project-files-on-older-bash branch July 14, 2024 16:51
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

Comments