git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Joey HessNext: Miklos Vajna
Message 23 of 27 in “git gc --auto: defer on battery”
  1. git gc --auto: defer on batteryMiklos Vajna, Mar 30, 2008
  2. Björn SteinbrinkMar 30, 2008
  3. git gc --auto: defer on batteryMiklos Vajna, Mar 30, 2008
  4. Björn SteinbrinkMar 30, 2008
  5. Linus TorvaldsMar 30, 2008
  6. Björn SteinbrinkMar 31, 2008
  7. Junio C HamanoMar 31, 2008
  8. Linus TorvaldsMar 31, 2008
  9. Björn SteinbrinkMar 31, 2008
  10. fetchmail (Re: [PATCH] git gc --auto: defer on battery)Linus Torvalds, Mar 31, 2008
  11. commit: resurrect "gc --auto" at the endJohannes Schindelin, Apr 2, 2008
  12. Johannes SchindelinMay 14, 2008
  13. Junio C HamanoMay 14, 2008
  14. Johannes SchindelinMay 14, 2008
  15. Holger SchurigMay 15, 2008
  16. 0/4 add pre-auto-gc hook for git-gc --autoMiklos Vajna, Mar 31, 2008
  17. 1/4 git-gc --auto: add pre-auto-gc hookMiklos Vajna, Mar 31, 2008
  18. 2/4 git-gc: add a --no-verify option to bypass the pre-auto-gc hookMiklos Vajna, Mar 31, 2008
  19. 3/4 Documentation/hooks: add pre-auto-gc hookMiklos Vajna, Mar 31, 2008
  20. 4/4 templates: add an example pre-auto-gc hookMiklos Vajna, Mar 31, 2008
  21. Brian GernhardtMar 31, 2008
  22. Joey HessMar 31, 2008
  23. Johannes SchindelinMar 30, 2008
  24. Miklos VajnaMar 30, 2008
  25. Brandon CaseyMar 31, 2008
  26. Miklos VajnaMar 31, 2008
  27. Brandon CaseyMar 31, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.