git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] hooks/pre-auto-gc-battery: allow gc to run on non-laptops
@ 2018-02-28  4:48 Adam Borowski
  2018-02-28 18:16 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Borowski @ 2018-02-28  4:48 UTC (permalink / raw)
  To: git, Junio C Hamano, Miklos Vajna; +Cc: Adam Borowski

Desktops and servers tend to have no power sensor, thus on_ac_power returns
255 ("unknown").

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>
---
 contrib/hooks/pre-auto-gc-battery | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/hooks/pre-auto-gc-battery b/contrib/hooks/pre-auto-gc-battery
index 6a2cdebdb..7ba78c4df 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
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-28 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28  4:48 [PATCH] hooks/pre-auto-gc-battery: allow gc to run on non-laptops Adam Borowski
2018-02-28 18:16 ` Junio C Hamano
2018-02-28 21:46   ` Adam Borowski
2018-02-28 21:57     ` Junio C Hamano
2018-02-28 22:12       ` [PATCH v2] " Adam Borowski
2018-02-28 22:24         ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).