File: pre-commit

package info (click to toggle)
mupdf 1.14.0%2Bds1-4%2Bdeb10u3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 57,116 kB
  • sloc: ansic: 314,752; java: 2,498; javascript: 1,210; python: 655; makefile: 494; sh: 206; sed: 13; awk: 6
file content (19 lines) | stat: -rwxr-xr-x 391 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
#
# pre-commit hook to fix whitespace errors
#
# Uses the core.whitespace or .gitattributes whitespace=... settings.
#
# see also: "man git-config" under core.whitespace
# see also: "man gitattributes"
#

PATCH=P.diff

if ! git diff --cached --check --quiet
then
	git diff --cached > $PATCH
	git apply --cached -R $PATCH
	git apply --cached --whitespace=fix $PATCH
	rm $PATCH
fi