This commit is contained in:
David Wengier 2022-08-25 19:26:56 +10:00
Родитель 10f524c1e2
Коммит c9dadbde7a
2 изменённых файлов: 0 добавлений и 41 удалений

Просмотреть файл

@ -1,15 +0,0 @@
#!/bin/sh
LC_ALL=C
# Select files to format
FILES=$(git show --name-only --pretty="")
[ -z "$FILES" ] && exit 0
# Format all selected files with dotnet-format
echo "dotnet-format: Formatting changed source files.."
echo "$FILES" | cat | xargs | sed -e 's/ /,/g' | xargs dotnet-format --folder . --include >/dev/null
echo "dotnet-format: $(git diff --cached --numstat | wc -l) file(s) formatted."
# Add files to staging
echo "$FILES" | xargs git add
exit 0

Просмотреть файл

@ -1,26 +0,0 @@
# Check dotnet-format is installed or not
$dotnetFormat = Get-Command dotnet-format -ErrorAction Ignore -CommandType Application
if ($dotnetFormat)
{
Write-Host -f Magenta "dotnet format tool is already installed."
}
else
{
Write-Host -f Magenta "Installing dotnet-format tool.."
& dotnet tool install -g dotnet-format
}
# We need to change default git hooks directory as .git folder is not tracked. And by default hooks are stored in .git/hooks folder.
# So we are setting git hooks default directory to .githooks, so that we can track and version the git hooks.
& git config core.hooksPath .githooks
& $PSScriptRoot\eng\common\Build.ps1 -restore -build -pack $args
function ExitWithExitCode([int] $exitCode) {
if ($ci -and $prepareMachine) {
Stop-Processes
}
exit $exitCode
}
ExitWithExitCode $LASTEXITCODE