#!/bin/sh # # Commit hook designed to keep tab characters out of ASDF. # Written by Daniel Herring, released into the public domain. if git-rev-parse --verify HEAD >/dev/null 2>&1 then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi for f in $(git diff --cached --name-only --diff-filter=AM $against) do case "$f" in #( *.asd | *.lisp | *.script) if (git diff --cached -p $against "$f" | grep ' ' > /dev/null 2>&1) then echo "Error: This git repository disallows the #\Tab character in lisp files." echo "Only spaces should be used for indenting lisp code." echo "In emacs, 'M-x untabify' and (setq indent-tabs-mode nil) may help." echo echo "First offending file and lines:" echo "$f" (git diff --cached -p $against "$f" | grep ' ' 2>&1) exit 1 fi ;; esac done # nothing else to complain about exit 0