Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2018-03-01 01:12:04 +0300
committerJunio C Hamano <gitster@pobox.com>2018-03-01 01:24:46 +0300
commit781262c5e7ad4a7813c528803117ed0d2e8c5172 (patch)
tree3c9a9a78a247d72538392fc19e25ac4037b3089f /contrib/hooks
parent38e79b1fdab9244e1727d0698afcf3bb8956c0a4 (diff)
hooks/pre-auto-gc-battery: allow gc to run on non-laptops
Desktops and servers tend to have no power sensor, thus on_ac_power returns 255 ("unknown"). Thus, let's take any answer other than 1 ("battery") as no contraindication to run gc. If that tool returns "unknown", there's no point in querying other sources as it already queried them, and is smarter than us (can handle multiple adapters). Reported by: Xin Li <delphij@google.com> Signed-off-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/hooks')
-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