Skip to content

Commit 7fabd64

Browse files
committed
Add path expansion test. Expand --list config query, accumulate exit codes.
1 parent f18271c commit 7fabd64

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

git-secrets

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,17 @@ case "${COMMAND}" in
338338
--scan-history) scan_with_fn_or_die "scan_history" "$@" ;;
339339
--list)
340340
if [ ${GLOBAL} -eq 1 ]; then
341-
git config --global --get-regex secrets.*
341+
RESULT=1
342+
if git config --global --get-regex --type path "^secrets\.providers$"; then RESULT=0; fi
343+
if git config --global --get-regex "^secrets\.patterns$"; then RESULT=0; fi
344+
if git config --global --get-regex "^secrets\.allowed$"; then RESULT=0; fi
345+
[ $RESULT -eq 0 ]
342346
else
343-
git config --get-regex secrets.*
347+
RESULT=1
348+
if git config --get-regex --type path "^secrets\.providers$"; then RESULT=0; fi
349+
if git config --get-regex "^secrets\.patterns$"; then RESULT=0; fi
350+
if git config --get-regex "^secrets\.allowed$"; then RESULT=0; fi
351+
[ $RESULT -eq 0 ]
344352
fi
345353
;;
346354
--install)

test/git-secrets.bats

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,14 @@ load test_helper
311311
[ $status -eq 0 ]
312312
}
313313

314+
@test "Expands ~ in providers" {
315+
repo_run git-secrets --add-provider -- '~/test'
316+
[ $status -eq 0 ]
317+
repo_run git-secrets --list
318+
[ $status -eq 0 ]
319+
echo "$output" | grep -F "${HOME}/test"
320+
}
321+
314322
@test "--recursive cannot be used with SCAN_*" {
315323
repo_run git-secrets --scan -r --cached
316324
[ $status -eq 1 ]

0 commit comments

Comments
 (0)