diff --git a/Makefile.python b/Makefile.python --- a/Makefile.python +++ b/Makefile.python @@ -27,6 +27,13 @@ check: $(FLAKE) $(FLAKEFLAGS) swh $(PYTHON_BIN) +.PHONY: check-staged +check-staged: + $(FLAKE) $(FLAKEFLAGS) swh $(PYTHON_BIN) + git diff -z --staged --name-only -- '*.py' \ + | xargs -0 -L1 -i'{}' /bin/sh -c \ + "git show ':{}' | $(FLAKE) $(FLAKEFLAGS) --stdin-display-name '{}' -" + .PHONY: lint lint: $(LINT) $(LINTFLAGS) $(PYMODULE) diff --git a/bin/git-add-pre-commit-hook b/bin/git-add-pre-commit-hook --- a/bin/git-add-pre-commit-hook +++ b/bin/git-add-pre-commit-hook @@ -13,7 +13,7 @@ if ! [ -x "$HOOK" ] ; then cat > "$HOOK" <