We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 476517b commit 0524afcCopy full SHA for 0524afc
githooks/pre-commit-add-contributor
@@ -6,8 +6,16 @@ else
6
if git log --pretty="%an%n%cn" | sort | uniq | grep -q "$(git config user.name)"; then
7
exit 0
8
else
9
- printf "Please add yourself (copy the next line) to the CONTRIBUTORS.md file.\n";
10
- printf '%s <%s>\n\n' "$(git config user.name)" "$(git config user.email)";
11
- exit 1
+
+ expected=$(printf '%s <%s>' "$(git config user.name)" "$(git config user.email)");
12
+ if grep -q "$expected" CONTRIBUTORS; then
13
+ exit 0 # Already in the file but first time commit in the git history
14
+ else
15
+ echo "Please add yourself (copy the next line) to the CONTRIBUTORS.md file.";
16
+ echo $expected
17
+ exit 1
18
+ fi
19
20
fi
21
0 commit comments