Skip to content

Commit

Permalink
feat: add git hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaitanyabsprip committed Jun 6, 2024
1 parent 8dcfd93 commit 8a78646
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .githooks/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

sudo make install
15 changes: 15 additions & 0 deletions .githooks/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

script_name=$(basename "$0")
if ! repo_root=$(git rev-parse --show-toplevel); then
echo "Not a git repository (or any of the parent directories)."
exit 1
fi
cd "$repo_root" || exit
hooks_dir=".git/hooks"
for path in .githooks/*; do
file="$(basename "$path")"
if [ "$file" = "$script_name" ] || [ ! -f "$path" ]; then continue; fi
ln -sf "$path" "$hooks_dir/$file"
echo "Installed $file to $hooks_dir/$file"
done

0 comments on commit 8a78646

Please sign in to comment.