Skip to content

Commit 1f0049e

Browse files
committed
fix file name space when iterating git diffs
1 parent 9ef9f30 commit 1f0049e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.githooks/pre-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ else
2020
against=$(git hash-object -t tree /dev/null)
2121
fi
2222
has_secrets=0
23-
for FILE in `git diff --cached --name-only --diff-filter=AM $against` ; do
23+
for FILE in "`git diff --cached --name-only --diff-filter=AM $against`" ; do
2424
# Check if the file contains secrets
2525
detected=$(azdev scan -f "$FILE" | python -c "import sys, json; print(json.load(sys.stdin)['secrets_detected'])")
2626
if [ "$detected" = "True" ]; then

azure-pipelines.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,8 @@ jobs:
11371137
. env/bin/activate
11381138
git fetch origin --depth=1 $(System.PullRequest.TargetBranch)
11391139
declare -A secret_files
1140-
for FILE in `git diff --name-only --diff-filter=AM origin/$(System.PullRequest.TargetBranch)` ; do
1140+
for FILE in "`git diff --name-only --diff-filter=AM origin/$(System.PullRequest.TargetBranch)`" ; do
1141+
echo $FILE
11411142
detected=$(azdev scan -f "$FILE" | python -c "import sys, json; print(json.load(sys.stdin)['secrets_detected'])")
11421143
if [ $detected == 'True' ]; then
11431144
printf "\033[0;31mDetected secrets from %s, You can run 'azdev mask' to remove secrets.\033[0m\n" "$FILE"

0 commit comments

Comments
 (0)