diff --git a/eng/common/pipelines/templates/steps/credscan.yml b/eng/common/pipelines/templates/steps/credscan.yml index a202961a30e0..d2704bce6f22 100644 --- a/eng/common/pipelines/templates/steps/credscan.yml +++ b/eng/common/pipelines/templates/steps/credscan.yml @@ -8,7 +8,11 @@ steps: - pwsh: | if ("$(Build.Reason)" -eq 'PullRequest') { $targetBranch = "origin/$(System.PullRequest.TargetBranch)" -replace "refs/heads/" - $changedFiles = git diff $targetBranch HEAD --name-only --diff-filter=d + + # Add config to disable the quote and encoding on file name. + # Ref: https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Unicode-Support#disable-quoted-file-names + # Ref: https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Unicode-Support#disable-commit-message-transcoding + $changedFiles = git -c core.quotepath=off -c i18n.logoutputencoding=utf-8 diff $targetBranch HEAD --name-only --diff-filter=d $changedFiles | ForEach-Object { Add-Content -Path "${{ parameters.SourceDirectory }}/credscan.tsv" -Value "${{ parameters.SourceDirectory }}/$_"} } else {