16. smarttab問題(1)
• 元ソースのインデントは
–
–
–
–
1段目:4SPACE
2段目:tab
3段目: tab 4SPACE
4段目: tab tab
• いわゆるsmarttab(by JSHint)
• Java ScriptのIndent規約
– http://www.oracle.com/technetwork/java/javase/documentatio
n/codeconventions-136091.html#262
– Four spaces should be used as the unit of indentation. The exact
construction of the indentation (spaces vs. tabs) is unspecified.
Tabs must be set exactly every 8 spaces (not 4).
16
19. smarttab問題(3)
$ cat .git/hooks/pre-commit
#!/bin/bash
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
#master branch is ok
git branch | grep -e '^* master$' && exit 0
RET=0
if git branch | grep -e '^* target-branch$' >/dev/null 2>&1
then
for FILE in `git diff-index --name-status $against -- | grep -E '^[AUM].*¥.js$'| cut -c3-`;
do
sed -i -e 's/¥t/
/g' "$FILE"
done
exit $RET
19
fi