From: Jonathan del Strother <jon.delStrother@bestbefore.tv>
To: git@vger.kernel.org
Cc: Miklos Vajna <vmiklos@frugalware.org>,
Jonathan del Strother <jon.delStrother@bestbefore.tv>
Subject: [PATCH] Add OS X support to the pre-auto-gc example hook
Date: Tue, 23 Sep 2008 23:43:23 +0100 [thread overview]
Message-ID: <1222209803-4401-1-git-send-email-jon.delStrother@bestbefore.tv> (raw)
Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
---
Darwin / OS X has a pmset tool for getting power management information. How about adding OS X support to the auto-gc hook?
Shell scripting isn't my forté, suggestions for improvements would be welcome.
contrib/hooks/pre-auto-gc-battery | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/contrib/hooks/pre-auto-gc-battery b/contrib/hooks/pre-auto-gc-battery
index 0096f57..0b7bcde 100644
--- a/contrib/hooks/pre-auto-gc-battery
+++ b/contrib/hooks/pre-auto-gc-battery
@@ -1,9 +1,9 @@
#!/bin/sh
#
# An example hook script to verify if you are on battery, in case you
-# are running Linux. Called by git-gc --auto with no arguments. The hook
-# should exit with non-zero status after issuing an appropriate message
-# if it wants to stop the auto repacking.
+# are running Linux or OS X. Called by git-gc --auto with no arguments.
+# The hook should exit with non-zero status after issuing an appropriate
+# message if it wants to stop the auto repacking.
#
# This hook is stored in the contrib/hooks directory. Your distribution
# may have put this somewhere else. If you want to use this hook, you
@@ -30,6 +30,9 @@ then
elif grep -q '0x01$' /proc/apm 2>/dev/null
then
exit 0
+elif test -x /usr/bin/pmset && (! /usr/bin/pmset -g batt | grep -q 'Battery Power' )
+then
+ exit 0
fi
echo "Auto packing deferred; not on AC"
--
1.6.0.2.308.gd442a.dirty
next reply other threads:[~2008-09-23 22:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-23 22:43 Jonathan del Strother [this message]
2008-09-25 23:20 ` [PATCH] Add OS X support to the pre-auto-gc example hook Miklos Vajna
2008-09-27 9:53 ` Jonathan del Strother
2008-09-29 23:36 ` [PATCH v2] " Jonathan del Strother
2008-09-30 15:00 ` Miklos Vajna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1222209803-4401-1-git-send-email-jon.delStrother@bestbefore.tv \
--to=jon.delstrother@bestbefore.tv \
--cc=git@vger.kernel.org \
--cc=vmiklos@frugalware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).