From: Johannes Schindelin Date: Sun, 30 Mar 2008 23:41:18 GMT Subject: Re: [PATCH] git gc --auto: defer on battery Message-ID: In-Reply-To: <20080330231408.GR11666@genesis> Hi, On Mon, 31 Mar 2008, Miklos Vajna wrote: > + 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 > @@ -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