We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 891358d commit bdcf3f5Copy full SHA for bdcf3f5
tools/git/hooks/pre-commit
@@ -68,9 +68,19 @@ on_error() {
68
69
# Runs clean-up tasks.
70
cleanup() {
71
+ # Restore stashed changes to the working tree:
72
+ git stash pop -q
73
+
74
echo '' >&2
75
}
76
77
+# Runs initialization tasks.
78
+init() {
79
+ # Stash any changes to the working tree that are not going to be committed:
80
+ git stash -q --keep-index
81
+ return 0
82
+}
83
84
# Checks for non-ASCII filenames (to ensure cross platform portability).
85
check_filenames() {
86
local num_files
@@ -340,6 +350,10 @@ run_lint() {
340
350
341
351
# Main execution sequence.
342
352
main() {
353
+ init
354
+ if [[ "$?" -ne 0 ]]; then
355
+ on_error 1
356
+ fi
343
357
check_filenames
344
358
if [[ "$?" -ne 0 ]]; then
345
359
on_error 1
0 commit comments