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

Re: [PATCH] grep: --full-tree

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 29, 2009, 19:49 UTC
Message-ID
<7v3a3x9kml.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20091129183217.GB21520@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> On Sun, Nov 29, 2009 at 11:28:27AM +0100, Johannes Schindelin wrote:
> ...
>> > When the number of "git grep" crash fatalities rises above zero, maybe 
>> > this line of reasoning will be relevant.
>> 
>> Sure.  Let's wait for the first crash fatality, and only react then.  No 
>> need to think ahead.
>
> ... The actual situation
> at hand is a git grep configuration variable. I am weighing the
> preference of people who use git every day and want it to work in a
> certain way against the possibility that somebody helping them will be
> slightly inconvenienced or surprised.

While my position is *not* "hurting people who help is too grave and we shouldn't even weigh other upsides against it---bad is bad is bad, and it is absolutely bad" (which is what I think Dscho is saying), I think "slightly inconvenienced or surprised" is trying to make it sound a lot lighter than it is.

Imagine you are helping somebody to track down a bug in a project whose source happens to be under git. You two scratch your heads together, and you try to find if the function you are fixing have other call sites, and you run "git grep" to find them. You think you covered the whole tree, identified all the callsites and made sure that the updated behaviour of the function with your fix is consistent with all of them. But it turns out that you didn't check the whole tree, due to user's configuration, and you didn't notice.

You can easily waste 30 minutes of two people until you realize what happened. Because the whole point of your grep.fulltree configuration is that you can set it once and forget about it, even after you noticed that your grep didn't look in the whole tree as you expected, the configuration variable is not the first thing that will come to your mind. You will waste more minutes wondering why grep is not working as you expect, until you finally come up with a suggestion to set the configuration to make grep look in the full tree by default in her repository.

Put it another way, your "I can set it and forget about it" may be a way to solve "differentiating two things is a mental burden and I do not want to think about it". But I do not think the "mental burden" problem is necessarily what we want to solve. The "set and forget" will bring confusion.

The best solution to the "mental burden" problem may not even be "I can set it and forget about it". An obvious solution to that problem, that is far easier to explain, is not to have two things to begin with, and that is what we do: "If you want to grep in the whole tree, you go to the top and run grep there." Of course, its downside is that it is often cumbersome to "got to the top" when you are somewhere deep.

That is why I think it would be a lot better solution to spend our efforts making sure that both semantics can be called for from the command line in a concise and clear way. IOW, the problem I see worth solving first is not the "mental burden" problem, but is "differentiating two things is necessary, but it is cumbersome to say which one I want."

You probably can add both configuration and concise command line syntax, but "solving" the "mental burden" problem will make you forget about the need to use --full-tree option (or its quivalent that will happen in the solution of the "cumbersome to say which one I want" problem). On the other hand, not "solving" the "mental burden" problem will hopefully train your brain and your fingers to always be aware of and to say which one you want, to the point that you do not even have to think.

For that to happen, "cumbersome to say which" problem must be solved nicely, of course.

> ... Something that will happen much
> less frequently than the person actually _using_ git, and something
> which has much smaller negative consequences than people dying.

It is of course not _fatal_, but there are not many things that are fatal. Saying "that is not fatal so it is Ok" is not particularly a good way to weigh downsides against upsides.

Previous: Jeff KingNext: Felipe Contreras
Message 36 of 68 in “grep: --full-tree”
  1. grep: --full-treeJunio C Hamano, Nov 24, 2009
  2. Michael J GruberNov 25, 2009
  3. Junio C HamanoNov 25, 2009
  4. Sverre RabbelierNov 25, 2009
  5. Junio C HamanoNov 25, 2009
  6. Sverre RabbelierNov 25, 2009
  7. Junio C HamanoNov 25, 2009
  8. Sverre RabbelierNov 25, 2009
  9. Johannes SchindelinNov 25, 2009
  10. Sverre RabbelierNov 25, 2009
  11. Jeff KingNov 25, 2009
  12. Jeff KingNov 25, 2009
  13. Junio C HamanoNov 25, 2009
  14. Jeff KingNov 25, 2009
  15. Junio C HamanoNov 25, 2009
  16. Jeff KingNov 25, 2009
  17. James PickensNov 25, 2009
  18. Jeff KingNov 25, 2009
  19. James PickensNov 26, 2009
  20. Jeff KingNov 27, 2009
  21. Junio C HamanoNov 27, 2009
  22. Johannes SchindelinNov 27, 2009
  23. Jeff KingNov 27, 2009
  24. Johannes SchindelinNov 27, 2009
  25. Uri OkrentNov 27, 2009
  26. Junio C HamanoNov 27, 2009
  27. Uri OkrentNov 27, 2009
  28. Jeff KingNov 27, 2009
  29. Uri OkrentNov 29, 2009
  30. Felipe ContrerasNov 29, 2009
  31. Jeff KingNov 27, 2009
  32. Johannes SchindelinNov 27, 2009
  33. Jeff KingNov 27, 2009
  34. Johannes SchindelinNov 29, 2009
  35. Jeff KingNov 29, 2009
  36. Junio C HamanoNov 29, 2009
  37. Felipe ContrerasNov 29, 2009
  38. Junio C HamanoNov 27, 2009
  39. Jeff KingNov 27, 2009
  40. Johannes SchindelinNov 29, 2009
  41. Jeff KingNov 29, 2009
  42. Matthieu MoyNov 27, 2009
  43. Johannes SchindelinNov 27, 2009
  44. Wincent ColaiutaNov 25, 2009
  45. Junio C HamanoNov 26, 2009
  46. A Large Angry SCMNov 26, 2009
  47. Junio C HamanoNov 26, 2009
  48. A Large Angry SCMNov 26, 2009
  49. Junio C HamanoNov 26, 2009
  50. James PickensNov 26, 2009
  51. Junio C HamanoNov 25, 2009
  52. Jeff KingNov 25, 2009
  53. A Large Angry SCMNov 25, 2009
  54. Jeff KingNov 25, 2009
  55. A Large Angry SCMNov 25, 2009
  56. Jeff KingNov 25, 2009
  57. Felipe ContrerasNov 29, 2009
  58. Uri OkrentNov 29, 2009
  59. Junio C HamanoNov 26, 2009
  60. Jeff KingNov 27, 2009
  61. A Large Angry SCMNov 25, 2009
  62. Junio C HamanoNov 25, 2009
  63. A Large Angry SCMNov 25, 2009
  64. A Large Angry SCMNov 25, 2009
  65. Johannes SchindelinNov 25, 2009
  66. Junio C HamanoNov 25, 2009
  67. Johannes SchindelinNov 26, 2009
  68. Junio C HamanoNov 26, 2009

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.