Commit Graph

6 Commits

Author SHA1 Message Date
Adam Borowski
781262c5e7 hooks/pre-auto-gc-battery: allow gc to run on non-laptops
Desktops and servers tend to have no power sensor, thus on_ac_power returns
255 ("unknown").  Thus, let's take any answer other than 1 ("battery") as
no contraindication to run gc.

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-28 14:24:46 -08:00
Panagiotis Astithas
c54c7b376d hooks/pre-auto-gc: adjust power checking for newer OS X
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>
2015-06-12 15:33:39 -07:00
Jonathan Nieder
2e820ba9bc mark contributed hooks executable
The docs in contrib/hooks/pre-auto-gc-battery suggest:

	For example, if the hook is stored in
	/usr/share/git-core/contrib/hooks/pre-auto-gc-battery:

	chmod a+x pre-auto-gc-battery
	cd /path/to/your/repository.git
	ln -sf /usr/share/git-core/contrib/hooks/pre-auto-gc-battery \
	     hooks/pre-auto-gc

Unfortunately on multi-user systems most users do not have write
access to /usr.  Better to mark the sample hooks executable in
the first place so users do not have to tweak their permissions to
use them by symlinking into .git/hooks/.

Reported-by: Olivier Berger <olivier.berger@it-sudparis.eu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-25 15:01:22 -08:00
Miklos Vajna
84ed4c5d11 Add Linux PPC support to the pre-auto-gc example hook
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-14 16:50:09 -07:00
Jonathan del Strother
c33912ae24 Add OS X support to the pre-auto-gc example hook
Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-30 12:27:20 -07:00
Miklos Vajna
f949844263 contrib/hooks: add an example pre-auto-gc hook
It disables git-gc --auto when you are running Linux and you are
not on AC.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-09 01:31:13 -07:00