diff options
author | David Pursehouse <dpursehouse@collab.net> | 2017-05-28 00:37:59 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-05-28 00:37:59 +0000 |
commit | 169d8ae93cb8294db9a82cd6de97e94ef53abf7c (patch) | |
tree | 39c705a89b06feae7791ffdfd29f0b45c26ec4a5 /hooks | |
parent | aa90021fbc3382fdac6171572c85ee07369c91e1 (diff) | |
parent | c9439facdde146e3a8ed6511499379e8b959c467 (diff) | |
download | git-repo-169d8ae93cb8294db9a82cd6de97e94ef53abf7c.tar.gz |
Merge "pre-auto-gc: Add support for Windows"
Diffstat (limited to 'hooks')
-rwxr-xr-x | hooks/pre-auto-gc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/hooks/pre-auto-gc b/hooks/pre-auto-gc index 43403022..c4107f51 100755 --- a/hooks/pre-auto-gc +++ b/hooks/pre-auto-gc | |||
@@ -1,9 +1,9 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # An example hook script to verify if you are on battery, in case you | 3 | # An example hook script to verify if you are on battery, in case you |
4 | # are running Linux or OS X. Called by git-gc --auto with no arguments. | 4 | # are running Windows, Linux or OS X. Called by git-gc --auto with no |
5 | # The hook should exit with non-zero status after issuing an appropriate | 5 | # arguments. The hook should exit with non-zero status after issuing an |
6 | # message if it wants to stop the auto repacking. | 6 | # appropriate message if it wants to stop the auto repacking. |
7 | 7 | ||
8 | # This program is free software; you can redistribute it and/or modify | 8 | # This program is free software; you can redistribute it and/or modify |
9 | # it under the terms of the GNU General Public License as published by | 9 | # it under the terms of the GNU General Public License as published by |
@@ -19,6 +19,16 @@ | |||
19 | # along with this program; if not, write to the Free Software | 19 | # along with this program; if not, write to the Free Software |
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | 21 | ||
22 | if uname -s | grep -q "_NT-" | ||
23 | then | ||
24 | if test -x $SYSTEMROOT/System32/Wbem/wmic | ||
25 | then | ||
26 | STATUS=$(wmic path win32_battery get batterystatus /format:list | tr -d '\r\n') | ||
27 | [ "$STATUS" = "BatteryStatus=2" ] && exit 0 || exit 1 | ||
28 | fi | ||
29 | exit 0 | ||
30 | fi | ||
31 | |||
22 | if test -x /sbin/on_ac_power && /sbin/on_ac_power | 32 | if test -x /sbin/on_ac_power && /sbin/on_ac_power |
23 | then | 33 | then |
24 | exit 0 | 34 | exit 0 |