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

Re: [PATCH] status: hint the user about -uno if read_directory takes too long

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 13, 2013, 16:16 UTC
Message-ID
<7vehfj46mu.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1363179556-4144-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 12 quoted lines
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index bbba728..e91d06f 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -178,6 +178,10 @@ advice.*::
>  		the template shown when writing commit messages in
>  		linkgit:git-commit[1], and in the help message shown
>  		by linkgit:git-checkout[1] when switching branch.
> +	statusUno::
> +		If collecting untracked files in linkgit:git-status[1]
> +		takes more than 2 seconds, hint the user that the option
> +		`-uno` could be used to stop collecting untracked files.

It looks to me that the way this paragraph conveys information is vastly different from all the others in the section. The section begins with "by setting their corresponding variables to false various advice messages can be squelched; here are the list of variables and which advice message each of them controls", so the description should be in "variable:: which advice message" form.

The noise this introduces to the test suite is a bit irritating and makes us think twice if this really a good change.

Show 20 quoted lines
> diff --git a/wt-status.c b/wt-status.c
> index ef405d0..6fde08b 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -540,7 +540,16 @@ void wt_status_collect(struct wt_status *s)
>  		wt_status_collect_changes_initial(s);
>  	else
>  		wt_status_collect_changes_index(s);
> -	wt_status_collect_untracked(s);
> +	if (s->show_untracked_files && advice_status_uno) {
> +		struct timeval tv1, tv2;
> +		gettimeofday(&tv1, NULL);
> +		wt_status_collect_untracked(s);
> +		gettimeofday(&tv2, NULL);
> +		s->untracked_in_ms =
> +			(uint64_t)tv2.tv_sec * 1000 + tv2.tv_usec / 1000 -
> +			((uint64_t)tv1.tv_sec * 1000 + tv1.tv_usec / 1000);
> +	} else
> +		wt_status_collect_untracked(s);
>  }

This is not wrong per-se but it took me two reads to spot that this is not "if advise is active, do the timer but do not collect; otherwise do just collect as before". I wonder if we can structure the code a bit better to make the timing bit less loud.

Show 14 quoted lines
>  static void wt_status_print_unmerged(struct wt_status *s)
> @@ -1097,6 +1106,15 @@ void wt_status_print(struct wt_status *s)
>  		wt_status_print_other(s, &s->untracked, _("Untracked files"), "add");
>  		if (s->show_ignored_files)
>  			wt_status_print_other(s, &s->ignored, _("Ignored files"), "add -f");
> +		if (advice_status_uno && s->untracked_in_ms > 2000) {
> +			status_printf_ln(s, GIT_COLOR_NORMAL,
> +					 _("It took %.2f seconds to collect untracked files."),
> +					 (float)s->untracked_in_ms / 1000);
> +			status_printf_ln(s, GIT_COLOR_NORMAL,
> +					 _("If it happens often, you may want to use option -uno"));
> +			status_printf_ln(s, GIT_COLOR_NORMAL,
> +					 _("to speed up by stopping displaying untracked files"));
> +		}

"to speed up by stopping displaying untracked files" does not look like giving a balanced suggestion. It is increasing the risk of forgetting about newly created files the user may want to add, but the risk is not properly warned.

I tend to agree that the new advice would help users if phrased in a right way. Do we want them in COLOR_NORMAL, or do we want to make them stand out a bit more (do we have COLOR_BLINK ;-)?

Previous: Torsten BögershausenNext: Duy Nguyen
Message 29 of 88 in “inotify to minimize stat() calls”
  1. Ramkumar RamachandraFeb 8, 2013
  2. Junio C HamanoFeb 8, 2013
  3. Junio C HamanoFeb 8, 2013
  4. Duy NguyenFeb 9, 2013
  5. Junio C HamanoFeb 9, 2013
  6. Junio C HamanoFeb 9, 2013
  7. Robert ZehFeb 9, 2013
  8. Ramkumar RamachandraFeb 9, 2013
  9. Ramkumar RamachandraFeb 9, 2013
  10. Ramkumar RamachandraFeb 9, 2013
  11. Duy NguyenFeb 9, 2013
  12. Ramkumar RamachandraFeb 9, 2013
  13. Ramkumar RamachandraFeb 9, 2013
  14. Duy NguyenFeb 10, 2013
  15. Duy NguyenFeb 10, 2013
  16. Duy NguyenFeb 10, 2013
  17. Junio C HamanoFeb 10, 2013
  18. Duy NguyenFeb 11, 2013
  19. Duy NguyenFeb 11, 2013
  20. Torsten BögershausenMar 7, 2013
  21. Junio C HamanoMar 8, 2013
  22. Torsten BögershausenMar 8, 2013
  23. Junio C HamanoMar 8, 2013
  24. Torsten BögershausenMar 8, 2013
  25. Duy NguyenMar 8, 2013
  26. Ramkumar RamachandraMar 10, 2013
  27. status: hint the user about -uno if read_directory takes too longNguyễn Thái Ngọc Duy, Mar 13, 2013
  28. Torsten BögershausenMar 13, 2013
  29. Junio C HamanoMar 13, 2013
  30. Duy NguyenMar 14, 2013
  31. Junio C HamanoMar 14, 2013
  32. Duy NguyenMar 15, 2013
  33. Torsten BögershausenMar 15, 2013
  34. Ramkumar RamachandraMar 15, 2013
  35. Junio C HamanoMar 15, 2013
  36. Torsten BögershausenMar 15, 2013
  37. Junio C HamanoMar 15, 2013
  38. Torsten BögershausenMar 15, 2013
  39. Junio C HamanoMar 15, 2013
  40. Torsten BögershausenMar 16, 2013
  41. Junio C HamanoMar 17, 2013
  42. Duy NguyenMar 16, 2013
  43. demerphqFeb 10, 2013
  44. Duy NguyenFeb 10, 2013
  45. Magnus BäckFeb 14, 2013
  46. Ramkumar RamachandraFeb 10, 2013
  47. Duy NguyenFeb 11, 2013
  48. Erik Faye-LundFeb 10, 2013
  49. Duy NguyenFeb 11, 2013
  50. Karsten BleesFeb 12, 2013
  51. Duy NguyenFeb 13, 2013
  52. Duy NguyenFeb 13, 2013
  53. Jeff KingFeb 13, 2013
  54. Jeff KingFeb 13, 2013
  55. Karsten BleesFeb 13, 2013
  56. Jeff KingFeb 13, 2013
  57. Karsten BleesFeb 14, 2013
  58. name-hash.c: fix endless loop with core.ignorecase=trueKarsten Blees, Feb 27, 2013
  59. Junio C HamanoFeb 27, 2013
  60. Karsten BleesFeb 27, 2013
  61. name-hash.c: fix endless loop with core.ignorecase=trueKarsten Blees, Feb 27, 2013
  62. Junio C HamanoFeb 28, 2013
  63. Ramkumar RamachandraFeb 19, 2013
  64. Karsten BleesFeb 19, 2013
  65. Drew NorthupFeb 19, 2013
  66. Duy NguyenFeb 19, 2013
  67. Junio C HamanoFeb 9, 2013
  68. Robert ZehFeb 10, 2013
  69. Martin FickFeb 10, 2013
  70. Robert ZehFeb 10, 2013
  71. Duy NguyenFeb 11, 2013
  72. Robert ZehFeb 11, 2013
  73. Ramkumar RamachandraFeb 19, 2013
  74. Robert ZehApr 24, 2013
  75. Duy NguyenApr 24, 2013
  76. Robert ZehApr 25, 2013
  77. Duy NguyenApr 25, 2013
  78. Robert ZehApr 26, 2013
  79. Thomas RastApr 25, 2013
  80. Robert ZehApr 25, 2013
  81. Thomas RastApr 25, 2013
  82. Thomas RastApr 27, 2013
  83. Duy NguyenApr 27, 2013
  84. Ramkumar RamachandraFeb 9, 2013
  85. Ævar Arnfjörð BjarmasonFeb 14, 2013
  86. Junio C HamanoFeb 14, 2013
  87. Ramkumar RamachandraFeb 19, 2013
  88. Duy NguyenApr 30, 2013

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.