cpplint_pre_commit.hook 272 字节
Newer Older
Y
Yi Wang 已提交
1 2 3 4 5 6 7 8 9 10 11 12
#!/bin/bash

TOTAL_ERRORS=0

# The trick to remove deleted files: https://stackoverflow.com/a/2413151
for file in $(git diff --cached --name-status | awk '$1 != "D" {print $2}'); do
    cpplint $file;
    TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?);
done

exit $TOTAL_ERRORS