summaryrefslogtreecommitdiff
path: root/contrib/hooks/pre-auto-gc-battery
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-03-14 12:01:04 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-03-14 12:01:04 -0700
commitb423234dde181bc8b951ec570ad50dd83d39ddc7 (patch)
treeb85f5d08e05d5108c85653900c30d2f054a6f16b /contrib/hooks/pre-auto-gc-battery
parentMerge branch 'sg/test-x' (diff)
parenthooks/pre-auto-gc-battery: allow gc to run on non-laptops (diff)
downloadtgif-b423234dde181bc8b951ec570ad50dd83d39ddc7.tar.xz
Merge branch 'ab/pre-auto-gc-battery'
A sample auto-gc hook (in contrib/) to skip auto-gc while on battery has been updated to almost always allow running auto-gc unless on_ac_power command is absolutely sure that we are on battery power (earlier, it skipped unless the command is sure that we are on ac power). * ab/pre-auto-gc-battery: hooks/pre-auto-gc-battery: allow gc to run on non-laptops
Diffstat (limited to 'contrib/hooks/pre-auto-gc-battery')
-rwxr-xr-xcontrib/hooks/pre-auto-gc-battery2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/hooks/pre-auto-gc-battery b/contrib/hooks/pre-auto-gc-battery
index 6a2cdebdb7..7ba78c4dff 100755
--- a/contrib/hooks/pre-auto-gc-battery
+++ b/contrib/hooks/pre-auto-gc-battery
@@ -17,7 +17,7 @@
# ln -sf /usr/share/git-core/contrib/hooks/pre-auto-gc-battery \
# hooks/pre-auto-gc
-if test -x /sbin/on_ac_power && /sbin/on_ac_power
+if test -x /sbin/on_ac_power && (/sbin/on_ac_power;test $? -ne 1)
then
exit 0
elif test "$(cat /sys/class/power_supply/AC/online 2>/dev/null)" = 1