Skip to content

Commit 331b4af

Browse files
authored
Improve command hint to fix secret files not encrypted in index (#120) (#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.
1 parent aea3ff8 commit 331b4af

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog][1], and this project adheres to
2424
- Respect Git `core.hooksPath` setting when installing the pre-commit hook. (#104)
2525
- Zsh completion. (#107)
2626
- Fix salt generation for partial (patch) commits (#118)
27+
- Improve command hint to fix secret files not encrypted in index (#120)
2728

2829
## [2.1.0] - 2020-09-07
2930

tests/test_pre_commit.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ load "$BATS_TEST_DIRNAME/_test_helper.bash"
4747
[[ "${output}" = *"Transcrypt managed file is not encrypted in the Git index: sensitive_file"* ]]
4848
[[ "${output}" = *"You probably staged this file using a tool that does not apply .gitattribute filters as required by Transcrypt."* ]]
4949
[[ "${output}" = *"Fix this by re-staging the file with a compatible tool or with Git on the command line:"* ]]
50-
[[ "${output}" = *" git reset -- sensitive_file"* ]]
50+
[[ "${output}" = *" git rm --cached -- sensitive_file"* ]]
5151
[[ "${output}" = *" git add sensitive_file"* ]]
5252
}
5353

transcrypt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ realpath() {
5252
}
5353

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

0 commit comments

Comments
 (0)