Last active
February 2, 2018 21:54
-
-
Save jaredcnance/66e2755336331a97ad888d8c14c99aa4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This is a pre-commit script that will automatically ensure any new .csproj files | |
# have been added to the AllProjects solution. AllProjects the solution used on the build | |
# server and must be kept up to date. | |
# | |
# This will fail if you do not have VS 2017+ or the dotnet-cli installed. | |
solution="AllProjects.sln" | |
add_to_solution() { | |
dotnet sln $solution add $1 | |
git add $solution | |
return 0 | |
} | |
git diff --cached --name-only --diff-filter=A | while read -r line ; do | |
if `echo ${line} | grep '**/*.csproj$' 1>/dev/null 2>&1` | |
then | |
add_to_solution $line | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment