Re: [PATCH] git gc --auto: defer on battery
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 30, 2008, 23:41 UTC
- Message-ID
- <alpine.LSU.1.00.0803310137090.18259@racer.site>
- In-Reply-To
- <20080330231408.GR11666@genesis>
Hi,
On Mon, 31 Mar 2008, Miklos Vajna wrote:
Show 6 quoted lines
> + if ((fp = fopen("/proc/apm", "r"))) {
> + if (fscanf(fp, "%s %s %s %x", buf, buf, buf, &ac) != 4)
> + ac = 1;
> + fclose(fp);
> + return ac != 1;
> + }If /proc/apm could be opened, should you still try to open /proc/acpi/ac_adapter?
And what about system dependency? I mean, if at all, this stuff belongs to compat/. Definitely not into builtin-gc.c. And yes, that means that you should not call the function is_on_battery() blindly, but _only_ if defer_on_battery is set.
Ciao, Dscho
Show 6 quoted lines
> @@ -176,6 +220,11 @@ static int need_to_gc(void)
> append_option(argv_repack, "-A", MAX_ADD);
> else if (!too_many_loose_objects())
> return 0;
> +
> + if(is_on_battery()) {Style. As can be seen 3 lines earlier, we put a space after the "if".
Ciao, Dscho