Skip to content

Commit

Permalink
Improve command hint to fix secret files not encrypted in index (#120) (
Browse files Browse the repository at this point in the history
#130)

* Disable overly fussy shellcheck rule SC2155 for old code
* Update expected test output to match changed command hint

Code that's been unchanged for years is suddenly being flagged by
rule SC2155; perhaps this rule is stricter in newer versions of
`shellcheck` or action https://github.com/luizm/action-sh-checker ?

Fixes linting failures due to:

    SC2155: Declare and assign separately to avoid masking return values.
  • Loading branch information
jmurty committed Jan 15, 2022
1 parent aea3ff8 commit 331b4af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog][1], and this project adheres to
- Respect Git `core.hooksPath` setting when installing the pre-commit hook. (#104)
- Zsh completion. (#107)
- Fix salt generation for partial (patch) commits (#118)
- Improve command hint to fix secret files not encrypted in index (#120)

## [2.1.0] - 2020-09-07

Expand Down
2 changes: 1 addition & 1 deletion tests/test_pre_commit.bats
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ load "$BATS_TEST_DIRNAME/_test_helper.bash"
[[ "${output}" = *"Transcrypt managed file is not encrypted in the Git index: sensitive_file"* ]]
[[ "${output}" = *"You probably staged this file using a tool that does not apply .gitattribute filters as required by Transcrypt."* ]]
[[ "${output}" = *"Fix this by re-staging the file with a compatible tool or with Git on the command line:"* ]]
[[ "${output}" = *" git reset -- sensitive_file"* ]]
[[ "${output}" = *" git rm --cached -- sensitive_file"* ]]
[[ "${output}" = *" git add sensitive_file"* ]]
}

Expand Down
3 changes: 2 additions & 1 deletion transcrypt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ realpath() {
}

# establish repository metadata and directory handling
# shellcheck disable=SC2155
gather_repo_metadata() {
# whether or not transcrypt is already configured
readonly CONFIGURED=$(git config --get --local transcrypt.version 2>/dev/null)
Expand Down Expand Up @@ -429,7 +430,7 @@ save_helper_hooks() {
printf 'Fix this by re-staging the file with a compatible tool or with'
printf ' Git on the command line:\n' >&2
printf '\n' >&2
printf ' git reset -- %s\n' "$secret_file" >&2
printf ' git rm --cached -- %s\n' "$secret_file" >&2
printf ' git add %s\n' "$secret_file" >&2
printf '\n' >&2
exit 1
Expand Down

0 comments on commit 331b4af

Please sign in to comment.