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

Re: RFC: a plugin architecture for git extensions?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 6, 2011, 06:56 UTC
Message-ID
<20110506065601.GB13351@elie>
In-Reply-To
<BANLkTi=zrWR0GAm6n1Gs9XDCR6kXtjDW0A@mail.gmail.com>
Jon Seymour wrote:
Show 11 quoted lines
> I would appreciate any feedback you (or others) have about:
>
>     http://permalink.gmane.org/gmane.comp.version-control.git/172419
>
> In particular, I would be interested in feedback about how to best support:
>
> - multiple extensions - do we want support installing extensions in
> their own directories, per Pau's suggestion or simply allow them to
> write to a common directory?
> - multiple extension directories - how to support Jonathan's
> requirement to allow user specific extension directories?

Well, let's step back for a moment. What problem are we solving? I still don't even know the answer to that!

Once upon a time, all git commands lived on the $PATH (typically in /usr/bin, $HOME/bin, or some similar place) and could even be invoked directly as git-commandname. At some point someone noticed that by running

	git-<TAB>

it was possible to read the list of all git commands. Unfortunately the list was very long, and this seemed like a much worse introduction to git than the shorter list shown by "git --help".

There were also some related minor problems --- for example, git was putting more pressure than necessary on filesystems and other facilities to keep track of all the files in $bindir, and providing the dashed forms of commands provides a temptation to use them exclusively, making features (like aliases) of the git wrapper less discoverable. But the main thing was the tab completion.

The fix was to tuck away the individual commands somewhere under libexecdir, outside $PATH.

Now at some point in this discussion I thought you were solving a related problem. If a person were to install 100 new commands for git, or a single package with 100 commands in it, then

	git-<TAB>

would be daunting again. So the task becomes to find a place to tuck away these new commands without placing them on the $PATH.

But now I am less sure. The motivating example has less than 10 commands; that doesn't seem worth all the fuss at all. Why not just install the command on the $PATH? "git help work" _would_ work on all the systems I have easy access to. For example, if I write:

	install:
		install -m0755 git-work $(prefix)/bin
		install -d -m0755 $(prefix)/share/man/man1
		gzip -9 <git-work.1 >git-work.1.gz
		install -m0644 git-work.1.gz $(prefix)/share/man/man1/
		install -d -m0755 $(prefix)/bin
and the user runs
	make install
	PATH=$HOME/bin:$PATH

then "man git-work" will just work. Similarly, "git work --help" (which the git wrapper transforms to "git help work") would just work.

I see only a few potential problems remaining:
 1. There is no automatically generated documentation page pointing
    to the documentation for all new commands of this kind.  So
    I can run "git help -a" to learn about installed commands, but
    I cannot run "man git" to do so.  Likewise for info.
 2. On platforms like Windows that do not use manpages, my "git work"
    documentation will not show up with "git work --help".  For this,
    it would certainly be useful to have a GIT_HTML_PATH environment
    variable (or some similar name) that could be used to point to a
    list of directories with additional documentation.  The default
    could be something along the lines of the default library search
    path (but simpler), like:
	/usr/local/share/git/help:/usr/share/git/help
    Users installing new commands under $HOME might want to prepend
    something like
	$HOME/share/git/help:
    or whatever directory names suit their tastes.
    Even better might be a way for "git help" to ask the command
    where it puts its documentation, so "git help work" would
    internally run "git work --html-path".
 3. On a machine with multiple installations of git, my new command
    is not tied to any particular installation but shared by all of
    them.  This is a feature, not a bug.
 4. My command is visible with git-<TAB>, as mentioned above.

My comments about unprivileged users installing new commands were to explain why an alternative solution to (2) that uses a single directory where "git help" always looks would be inadequate. I still think that but luckily there is a large space of possible designs without that problem; two are mentioned in the description of (2) above.

Now problems 2 and 4 can be solved at the same time by introducing something like a GIT_PLUGINS_PATH variable that could be shared for both uses. I'm not so convinced that's a good idea (I prefer to see decoupled solutions to independent problems when it's simple to do) but it could very well turn out okay.

Previous: Jon SeymourNext: Jonathan Nieder
Message 70 of 105 in “RFC: a plugin architecture for git extensions?”
  1. Jon SeymourApr 27, 2011
  2. Jonathan NiederApr 27, 2011
  3. Jon SeymourApr 27, 2011
  4. Junio C HamanoApr 27, 2011
  5. Jon SeymourApr 27, 2011
  6. Junio C HamanoApr 27, 2011
  7. Jon SeymourApr 27, 2011
  8. Jon SeymourApr 27, 2011
  9. Junio C HamanoApr 27, 2011
  10. Jon SeymourApr 27, 2011
  11. Jon SeymourApr 27, 2011
  12. Michael J GruberApr 27, 2011
  13. Jon SeymourApr 27, 2011
  14. Jon SeymourApr 27, 2011
  15. Motiejus JakštysApr 27, 2011
  16. Jon SeymourApr 27, 2011
  17. Motiejus JakštysApr 27, 2011
  18. Carlos Martín NietoApr 27, 2011
  19. Jon SeymourApr 27, 2011
  20. Fredrik GustafssonApr 27, 2011
  21. Jon SeymourApr 27, 2011
  22. Pau Garcia i QuilesApr 27, 2011
  23. Jon SeymourApr 27, 2011
  24. Ævar Arnfjörð BjarmasonApr 27, 2011
  25. Jon SeymourApr 27, 2011
  26. Enrico WeigeltMay 13, 2011
  27. Andreas EricssonApr 27, 2011
  28. Jon SeymourApr 27, 2011
  29. Felipe ContrerasApr 27, 2011
  30. Jon SeymourApr 27, 2011
  31. Andreas EricssonApr 27, 2011
  32. Jon SeymourApr 27, 2011
  33. Jon SeymourApr 27, 2011
  34. A Large Angry SCMApr 27, 2011
  35. Jon SeymourApr 28, 2011
  36. Jon SeymourApr 28, 2011
  37. Jon SeymourApr 28, 2011
  38. Jon SeymourApr 28, 2011
  39. david@lang.hmApr 28, 2011
  40. Jon SeymourApr 29, 2011
  41. Motiejus JakštysApr 27, 2011
  42. Motiejus JakštysApr 27, 2011
  43. Junio C HamanoApr 27, 2011
  44. Junio C HamanoApr 27, 2011
  45. Drew NorthupApr 27, 2011
  46. Joey HessApr 27, 2011
  47. Drew NorthupApr 27, 2011
  48. Junio C HamanoApr 27, 2011
  49. Jonathan NiederApr 27, 2011
  50. Jon SeymourApr 27, 2011
  51. Andreas EricssonApr 28, 2011
  52. Junio C HamanoApr 27, 2011
  53. Jonathan NiederApr 27, 2011
  54. Junio C HamanoApr 28, 2011
  55. Jon SeymourApr 28, 2011
  56. Jon SeymourApr 28, 2011
  57. david@lang.hmApr 28, 2011
  58. Jon SeymourApr 28, 2011
  59. Jon SeymourApr 28, 2011
  60. Jon SeymourApr 28, 2011
  61. Andreas EricssonApr 28, 2011
  62. Jon SeymourApr 28, 2011
  63. Jonathan NiederApr 28, 2011
  64. Jon SeymourApr 28, 2011
  65. David AguilarMay 5, 2011
  66. Junio C HamanoMay 5, 2011
  67. Jon SeymourMay 5, 2011
  68. Junio C HamanoMay 6, 2011
  69. Jon SeymourMay 6, 2011
  70. Jonathan NiederMay 6, 2011
  71. Jonathan NiederMay 6, 2011
  72. Jon SeymourMay 6, 2011
  73. Jonathan NiederMay 6, 2011
  74. Jon SeymourMay 6, 2011
  75. Jonathan NiederMay 6, 2011
  76. Jon SeymourMay 8, 2011
  77. Jonathan NiederMay 8, 2011
  78. Jon SeymourMay 8, 2011
  79. Jeff KingMay 6, 2011
  80. John SzakmeisterMay 7, 2011
  81. Jon SeymourMay 8, 2011
  82. Jeff KingMay 9, 2011
  83. Jon SeymourMay 9, 2011
  84. Jeff KingMay 9, 2011
  85. Jon SeymourMay 9, 2011
  86. Jeff KingMay 9, 2011
  87. Jon SeymourMay 9, 2011
  88. Jon SeymourMay 9, 2011
  89. Jeff KingMay 9, 2011
  90. Jon SeymourMay 9, 2011
  91. Jeff KingMay 9, 2011
  92. Jon SeymourMay 9, 2011
  93. Jon SeymourMay 8, 2011
  94. Miles BaderMay 9, 2011
  95. David AguilarMay 14, 2011
  96. Andreas EricssonApr 28, 2011
  97. Jon SeymourApr 28, 2011
  98. Pau Garcia i QuilesApr 28, 2011
  99. Jon SeymourApr 28, 2011
  100. Pau Garcia i QuilesApr 28, 2011
  101. Jon SeymourApr 28, 2011
  102. Jon SeymourApr 28, 2011
  103. Jon SeymourApr 28, 2011
  104. Motiejus JakštysApr 27, 2011
  105. Jon SeymourApr 27, 2011

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.