hooks/pre-auto-gc: adjust power checking for newer OS X
authorPanagiotis Astithas <pastith@gmail.com>
Thu, 11 Jun 2015 14:37:25 +0000 (17:37 +0300)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Jun 2015 22:33:39 +0000 (15:33 -0700)
The output of "pmset -g batt" changed at some point from "Currently
drawing from 'AC Power'" to the slightly different "Now drawing from
'AC Power'". Starting the match from "drawing" makes the check work
in both old and new versions of OS X.

Signed-off-by: Panagiotis Astithas <pastith@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/hooks/pre-auto-gc-battery

index 9d0c2d1..6a2cdeb 100755 (executable)
@@ -33,7 +33,7 @@ elif grep -q "AC Power \+: 1" /proc/pmu/info 2>/dev/null
 then
        exit 0
 elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt |
-       grep -q "Currently drawing from 'AC Power'"
+       grep -q "drawing from 'AC Power'"
 then
        exit 0
 fi