diff options
1 files changed, 0 insertions, 30 deletions
| -rwxr-xr-x | .hooks/pre-commit.sh | 30 |
diff --git a/.hooks/pre-commit.sh b/.hooks/pre-commit.sh deleted file mode 100755 index 39dbcaa..0000000 --- a/.hooks/pre-commit.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# When copying/symlinking to .git/hooks/ remember to remove the filename extension! - -if [ -e "index.md" ]; then - echo "Refusing to run in a folder that contains an index.md file, since it will be deleted. Are you sure you are running this script from the parent directory of the directory, inside root variable?" - exit -fi - -root='./src/' -names=('about' 'archives' 'blog' 'tutorials' 'software' 'archived-websites' 'talks' 'misc') - -changes=0 -for name in ${names[@]}; do - if ! cmp "$root$name.md" "$root$name/index.md" >/dev/null 2>&1; then - cd "$root$name" - if [ -f 'index.md' ]; then rm 'index.md'; fi - ln "../$name.md" 'index.md' - cd '../../' - changes=1 - fi -done - -if [ "$changes" -eq '1' ]; then - echo '#========================================================================#' - echo '# Index files have been fixed! Consider adding them into the commit too! #' - echo '#========================================================================#' -else - echo 'Nothing was done!' -fi |