petemoore / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 1 forks source link

repo installs a pre-auto-gc hook that doesn't always work on desktops #91

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When repo initialises a new repository it installs a pre-auto-gc hook 
(introduced by http://review.source.android.com/r/c9ef744c7b5f) which is 
intended to prevent expensive git gc operations when on a laptop running on 
battery.

This script seems to believe that many desktop machines (including Z600s) are 
on battery, because they don't have an ACPI AC adapter resource and the script 
is checking for evidence that the machine is AC powered (and if not, skipping 
the gc) rather than the other way around (checking if it's battery powered).

I realise the hook script itself is just copied from git's examples, but I 
guess upstream only expect people to install the hook if they are on a laptop. 
Is there any way to update the hook to interpret a return code of 255 from 
on_ac_power (meaning it could not determine) as "okay, go ahead and GC"? We 
should at least do this for new repo checkouts I think.. many of my 
repositories had not been gc'ed ever and were noticeably faster after I forced 
it manually.

Original issue reported on code.google.com by torne@google.com on 7 Oct 2011 at 2:43