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 25, 2009, 19:32 UTC
Message-ID
<7vws1ewgbr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B0D2E19.6020100@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 36 quoted lines
> Junio C Hamano venit, vidit, dixit 24.11.2009 09:56:
>> While working inside a deep subdirectory, it sometimes is necessary to
>> find a string you see in a file you are working on from the files in the
>> entire project.  This is especially true when you are dipping your toe
>> into an unfamiliar project.
>> 
>> By default, "git grep" limits its search space to the current directory
>> and below (i.e. as if "-r ." is specified), and it is rather cumbersome to
>> repeat ../ as many times as necessary.  This new option tells "git grep"
>> not to limit the search space to the current directory.
>> 
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>> ---
>> 
>>  * In http://article.gmane.org/gmane.comp.version-control.git/111717, I
>>    once argued in the opposite way, but I think it is Ok to aim for making
>>    the default --full-tree in the longer run (cf. $gmane/127885).  This is
>>    the first step in that direction.
>> 
>>    I am not sure if there can be a sane way to flip the default without
>>    hurting existing scripts and users.  Backward compatibility always is
>>    a pain.
>
> On a related note, I had planned for a while now to go through the
> commands and check for inconsistencies w.r.t. to subdir default. For
> example, ls-files behaves like grep, whereas status is different. We
> already had discussions about the commit:path notation from a subdir. (I
> don't remember the outcome.) Of course, defaulting status differently
> could be dangerous. Having --full-tree as default for all commands and
> requiring an explicit "." sounds safer for all commands and not overly
> inconvenient. (I remember once wondering where my committed files are,
> looking at git ls-files output from a subdir.)
>
> I think we should make this behavior as uniform across commands as
> possible. Do we have a time frame for 1.7.0 within which one should
> achieve such incompatible changes?
I do not think there is such a consensus for a blanket change like that.

If you are starting a discussion to build one for a particular change (not necessarily the one you mentioned above) now, you are way too late for 1.7.0. The changes scheduled for 1.7.0 were glitches we have known for quite some time, and more importantly had a concensus on _how_ they should be handled long before 1.6.3 (May 6, 2009), and the most importantly, the steps in the transition plan since then have already been executing.

 - The plan for "git push" changes were already announced in 1.6.3, and
   the first step of transition was implemented there.
 - We already had consensus for changing the default "send-email"
   threading behaviour before 1.6.2 and it was scheduled to happen in
   1.6.3 but has been deferred until now.
 - For a long time, it has been known that it is confusing and unexpected
   to users that "git status" is a synonym for "git commit --dry-run".
   The plan to make "git status" different from "git commit --dry-run" has
   been done in mid August this year.
 - For a long time, "git diff" considered -b/-w options are only for
   controlling generation of patch text, and these options didn't affect
   the exit status (when run with --exit-code) nor suppress the patch
   header lines (i.e. "diff --git").  This could be argued as a bug (the
   same way as "some commands are relative to cwd by default and others
   are relative to the whole tree" can be), but it doesn't mean we can
   blame user's scripts for relying on the bug and change the semantics
   all of sudden.  We had been cooking the change since May 2009 and
   announcements were in all issues of "What's cooking" since Aug 2009 for
   this change.

Also, please do not confuse 1.7.0 with a license for "I do not like this and that, screw backward compatibility, and change things as if we were building git from scratch without any existing users". We need a solid transition plan to ease the pain for existing scripts and users.

As to ls-files, I haven't seen any good proposal of a smooth transition plan (like what we laid out for a few semantic changes for "git push" for 1.7.0), if we were to eventually change it, and I personally do not think there can be a smooth transition for that particular command. It is used as a very low level building block for people's scripts, and I don't think of a way to change its fundamental behaviour without causing people a lot of extra work. I doubt you can easily build a concensus that the benefit of "consistency" is worth it for such a change.

    Side note.  What we _could_ do is to make ls-files less (much less)
    necessary at the UI level for you to _type_ from the command line.
    Enumerate in what situations you used the command, think about the
    reason for each of occasions why you used it (e.g. "after a conflicted
    merge I wanted to find out which paths are still unresolved and
    'ls-files -u' was the most convenient way"), and eliminate the reason
    (e.g. "add a new (option to 'merge'|command) that reports the needed
    information in much more readable way than 'ls-files -u' does).
The same applies to "$treeish:$path" syntax.

It may be convenient if there were to specify "I want to name the path in HEAD~47 that corresponds to this file in the directory I am currently in." But that does not necessarily mean we should change the semantics and break existing users. One way to satisfy the wish without breaking existing users would be to start accepting "$treeish:./$relative".

Previous: Michael J GruberNext: Sverre Rabbelier
Message 3 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.