mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
pre-auto-gc: Add support for Windows
Previously, this would always have exited with 1 on Windows, causing "git gc --auto" to abort. Fix this by adding support for Windows. Change-Id: Ie519b366a11b6b18b2d465e892e738de3f4bbc99
This commit is contained in:
parent
ffb4b89099
commit
c9439facdd
@ -1,9 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# An example hook script to verify if you are on battery, in case you
|
# An example hook script to verify if you are on battery, in case you
|
||||||
# are running Linux or OS X. Called by git-gc --auto with no arguments.
|
# are running Windows, Linux or OS X. Called by git-gc --auto with no
|
||||||
# The hook should exit with non-zero status after issuing an appropriate
|
# arguments. The hook should exit with non-zero status after issuing an
|
||||||
# message if it wants to stop the auto repacking.
|
# appropriate message if it wants to stop the auto repacking.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -19,6 +19,16 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
if uname -s | grep -q "_NT-"
|
||||||
|
then
|
||||||
|
if test -x $SYSTEMROOT/System32/Wbem/wmic
|
||||||
|
then
|
||||||
|
STATUS=$(wmic path win32_battery get batterystatus /format:list | tr -d '\r\n')
|
||||||
|
[ "$STATUS" = "BatteryStatus=2" ] && exit 0 || exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if test -x /sbin/on_ac_power && /sbin/on_ac_power
|
if test -x /sbin/on_ac_power && /sbin/on_ac_power
|
||||||
then
|
then
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user