1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-03 14:03:33 +01:00

Add git hook for formating (#2224)

This commit is contained in:
Oscar Hinton 2022-09-08 10:27:17 +02:00 committed by GitHub
parent 5ecf7b9440
commit b612426782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

8
.git-hooks/pre-commit Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.cs")
if [ -n "$FILES" ]
then
dotnet format ./bitwarden-server.sln --no-restore --include $FILES
echo "$FILES" | xargs git add
fi

View File

@ -75,15 +75,11 @@ No grant of any rights in the trademarks, service marks, or logos of Bitwarden i
### Dotnet-format
We recently migrated to using dotnet-format as code formatter. All previous branches will need to updated to avoid large merge conflicts using the following steps:
Consider installing our git pre-commit hook for automatic formatting.
1. Check out your local Branch
2. Run `git merge 61dc65aa598b1f492d2f0222bb7bf0dd15d116f5`
3. Resolve any merge conflicts, commit.
4. Run `dotnet tool run dotnet-format`
5. Commit
6. Run `git merge -Xours 23b0a1f9df25058ab29785ecad9a233113c10889`
7. Push
```bash
git config --local core.hooksPath .git-hooks
```
### File Scoped Namespaces