From: Junio C Hamano Date: Mon, 31 Mar 2008 02:06:16 GMT Subject: Re: [PATCH] git gc --auto: defer on battery Message-ID: <7vr6drsl47.fsf@gitster.siamese.dyndns.org> In-Reply-To: Linus Torvalds writes: > On Mon, 31 Mar 2008, Bj?rn Steinbrink wrote: >> >> The /proc stuff is already deprecated IIRC, the new file to check on >> Linux is /sys/class/power_supply/AC/online. > > I would *seriously* suggest making this soem kind of generic callback and > not Linux-specific. > > How about making it more akin to a pre-auto-gc "hook" - run a script > instead of hardcoding something like this! That would be a sensible approach. We also would need to make sure that Porcelain that call "gc --auto" does not have an assumption that auto is ultra-cheap, however, as we are talking about potentially two fork-exec in the usual "noop" case with such a change, but we need to do that regardless. * git-svn has "every 1000 commits and one at the end" which should be Ok. * git-cvsimport does "repack -a -d" every 1k commits and once more at the end if there are many remaining loose objects. * "git-rebase -i" does one at the end, which should be Ok. * "git commit" used to have one at the end in the scripted version, but seems to have lost it in C rewrite. So I think we are Ok with an additional hook. By the way, Linus, is your MUA UTF-8 challenged? I see Björn's name on the To: header mangled.