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

Re: [PATCH] introduce git root

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 1, 2014, 03:04 UTC
Message-ID
<xmqqd284rryz.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpqoaro99xd.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> ... git rev-parse --show-toplevel is not just long,
> it's just not the place where people would look for (it's neither about
> revision nor about parsing, so clearly, "rev-parse" is not a good place
> to host the feature in the UI).

For the record, "rev-parse" is not about revisions in the first place. It started purely as a helper to implement "git log" in terms of "git rev-list" piped to "git diff-tree --stdin", which requires you to sift a command line argument list given to such a scripted "git log" into those to be passed to "rev-list" (i.e. primarily revision ranges) and those to be passed to "diff-tree" (i.e. primarily diff options and pathspecs).

Various subcommands "rev-parse" takes such as --show-git-dir were added only because there wasn't any single best "kitchen sink" command to tuck such a small feature that do not deserve a standalone command (e.g. "git root", which makes it sound as if the top-level of the working tree is the most important thing in the world, and adding other useful things such as --show-prefix to it, while it would make sense to have them there from the implementation point of view, would be hard to justify against the connotation the word "root" gives us), and we happened to pick "rev-parse" as a "kitchen sink" place, which is not better or worse as anything else.

If I were redoing this today, I would probably nominate the "git" potty as such a "kitchen synk" command. We have "--man-path" that shows the location of the manual pages, "--exec-path[=path]" that either shows or allows us to override the path to the subcommands, and "--show-prefix", "--show-toplevel", and friends may feel quite at home there.

Previous: Matthieu MoyNext: Christian Couder
Message 5 of 23 in “introduce git root”
  1. introduce git rootArjun Sreedharan, Nov 29, 2014
  2. Philip OakleyNov 29, 2014
  3. Arjun SreedharanNov 30, 2014
  4. Matthieu MoyNov 30, 2014
  5. Junio C HamanoDec 1, 2014
  6. Christian CouderDec 1, 2014
  7. Junio C HamanoDec 1, 2014
  8. Jeff KingDec 2, 2014
  9. Christian CouderDec 2, 2014
  10. Junio C HamanoDec 2, 2014
  11. Jeff KingDec 4, 2014
  12. Junio C HamanoDec 4, 2014
  13. Matthieu MoyDec 4, 2014
  14. Junio C HamanoDec 4, 2014
  15. Jeff KingDec 4, 2014
  16. Junio C HamanoDec 4, 2014
  17. Christian CouderDec 5, 2014
  18. Jeff KingDec 5, 2014
  19. Christian CouderDec 7, 2014
  20. Junio C HamanoDec 9, 2014
  21. Christian CouderDec 10, 2014
  22. Jeff KingDec 10, 2014
  23. Junio C HamanoDec 10, 2014

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.