diff --git a/README.md b/README.md index 4370236..64305ac 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ a couple of annoying blunders: 1. Scan the staged files for added secrets (using the fantastic gitleaks tool) 1. On a push, register the repo with Magnesium, (mg) my git repos management cli. -### Installation -## Template Installation +## Installation +### Template Installation 1. Clone this repo somewhere on your system. 1. Configure git to use these hooks as your template hook directory by adding this line to your global git config: `git config --global init.templatedir` diff --git a/post-checkout b/post-checkout index 0d783d9..4c59537 100755 --- a/post-checkout +++ b/post-checkout @@ -1,3 +1,2 @@ #!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-checkout'.\n"; exit 2; } git lfs post-checkout "$@" diff --git a/post-commit b/post-commit index abea40a..4c4511f 100755 --- a/post-commit +++ b/post-commit @@ -1,3 +1,2 @@ #!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-commit'.\n"; exit 2; } git lfs post-commit "$@" diff --git a/post-merge b/post-merge index 4a74b51..71ffed7 100755 --- a/post-merge +++ b/post-merge @@ -1,3 +1,2 @@ #!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-merge'.\n"; exit 2; } git lfs post-merge "$@" diff --git a/pre-push b/pre-push index 5aad5a2..d90ce83 100755 --- a/pre-push +++ b/pre-push @@ -1,7 +1,5 @@ #!/bin/sh -which mg >/dev/null 2> /dev/null || { printf >&2 "\nThis repository is configured for mg but 'mg' was not found on your path. Install it with go install github.com/taigrr/mg/cmd/mg@latest or remove this code from your templates in ~/.config/git/hooks.\n"; exit 2; } && mg register >/dev/null & - +mg register >/dev/null & test "$(git lfs track | wc -l)" -gt 0 || exit 0 -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push' and your templates in ~/.config/git/hooks.\n"; exit 2; } git lfs pre-push "$@"