Skip to content

Commit

Permalink
Support precommit from other cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanbanken committed Sep 22, 2016
1 parent 10f4bf0 commit 755f03d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions precommit.bash
@@ -1,5 +1,8 @@
#!/bin/bash

subject=$(pwd)
cd $(dirname $0)

####
# Google Style Guide formatting for Java
# https://github.com/google/google-java-format
Expand All @@ -11,7 +14,7 @@ if [ ! -f google-java-format-1.0-all-deps.jar ]; then
fi

javafmt="java -jar google-java-format-1.0-all-deps.jar --replace"
find . -name "*.java" -exec $javafmt {} +
find $subject -name "*.java" -exec $javafmt {} +

####
# LaTeX formatter texpretty: TeX prettyprinter
Expand Down Expand Up @@ -50,5 +53,5 @@ function texfmt() {
./texpty --no-comment-banner < $1 > $1.tmp && mv $1.tmp $1
}
export -f texfmt
find . -name "*.tex" -exec bash -c 'texfmt "$@"' bash {} \;
find $subject -name "*.tex" -exec bash -c 'texfmt "$@"' bash {} \;
# latexindent.pl -w **/*.tex

0 comments on commit 755f03d

Please sign in to comment.