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

Re: RFC: a plugin architecture for git extensions?

From
Jon Seymour <jon.seymour@gmail.com>
Date
May 9, 2011, 08:45 UTC
Message-ID
<BANLkTimKRo_36Ce2aFWWXdM1a+EgQ-u77Q@mail.gmail.com>
In-Reply-To
<20110509081219.GB6205@sigill.intra.peff.net>
On Mon, May 9, 2011 at 6:12 PM, Jeff King <peff@peff.net> wrote:
Show 34 quoted lines
> On Mon, May 09, 2011 at 05:49:27PM +1000, Jon Seymour wrote:
>
>> Yep, that was part of the motivation for the suggestion - something
>> that works consistently, assuming only a working git installation.
>>
>> Per one of my other notes, my initial inclination is to provide a
>> patch that implements support for
>>
>>      git --system-extensions-dir
>>
>> which would:
>>    - provide the caller with location that extensions could be
>> installed in (assuming the caller can acquire write privileges)
>>    - provide a guarantee that $(git --system-extensions-dir)/bin will
>> be on the path set up by the git wrapper and $(git
>> --system-extensions-dir)/man will be in the MANPATH searched by git
>> help
>>
>> Extensions could then use this information, together with git
>> --html-path to install themselves into these places using whatever
>> mechanism seems appropriate (either a POSIX shell script or a
>> make/install script).
>
> But is the system extension dir always the right place to do so? If I'm
> not root, then that probably won't be writable (or even if I am, I may
> want to install the extension only for the root user).
>
> If your proposal is for the user to decide on one of:
>
>  unzip -d "$(git --system-extension-dir)" git-foo.zip
>
> or
>
>  unzip -d "$HOME/.gitplugins" git-foo.zip
Show 5 quoted lines
>
> then they can make that decision. But if you're proposing that the
> extension-writer distribute a script, then it's more complicated. They
> would probably need to provide a "--user" versus "--system" option.
>

I am starting to think that deploy-via-zip/tar is unworkable for the case where the extension wants to supply html, since I think an attempt has to be made to deploy HTML in the path reported by git --html-path for reasons of HTML linkability from extension back to the pages from git-core.

Now, this might not always work, and the install script can either fail (to be re-run under sudo at users discretion) or degrade gracefully (install what it can, and warn).

Show 21 quoted lines
> It would also be tempting to write something like:
>
>  install_dir() {
>    if test "`id -u`" = "0"; then
>      git --system-extension-dir
>    else
>      echo $HOME/.gitplugins
>    fi
>  }
>
> but that is:
>
>  1. Not portable.
>
>  2. Does not allow for user-only installation by root.
>
> But all of this is a packaging best-practices issue, not an issue of
> what git needs to do to support it (you _could_ address the portability
> issue by having "git --preferred-extension-path" that did the
> appropriate platform-specific UID check, but that still doesn't address
> the second point).

So, suppose we call it --preferred-extension-path*, then if the user (root or otherwise) defines

    git config core.preferrred-extension-path ${HOME}/.gitplugins
then they get to choose where the installer next run will install extensions.

Also, this would only be a default - installation scripts could have a mechanism to specify an override on the command line. Of course, if they supply the override and it is not consistent with --preferred-extensions-path/core.preferred-extensions-path then they need to take steps to install that the bin directory is in the PATH, but that's a decision they take themselves as an alternative to acquiring the privileges required to modify the directory reported by git --preferred-extensions-path

The idea is for core to provide extension installers with just enough information that their installs will work and be discoverable by the core and enough control for distributions to determine the preferred location for such extensions.

* I would prefer --preferred-extension-dir rather than
--preferred-extension-path, since I think this name should specify a
single directory and not a list (otherwise the choice of destination
would be ambigiuous). I realise this creates an inconsistency with
--html-path and if consistency is preferred (or I have misinterpreted
what path normally means), I am happy to use
--preferred-extension-path.
jon.
Previous: Jeff KingNext: Jeff King
Message 85 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.