# RFC: a minimal plugin architecture

3 messages from 2011-04-28 to 2011-04-29. Participants: Jon Seymour, david@lang.hm.
Thread: https://gitlist.dev/t/27214

## Jon Seymour, 2011-04-28 23:22

Subject: RFC: a minimal plugin architecture
Message-ID: <BANLkTi=53dShgcsyTUP2aA+hvm6p+93XrA@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTi%3D53dShgcsyTUP2aA%2Bhvm6p%2B93XrA%40mail.gmail.com

```
Hi,

I am starting to get the idea that everyone feels I am being a little
too ambitious. Slow learner, I know.

I think this is because my visions are much grander than people are
willing to swallow right now, so I want to scale back to where I think
there is some consensus and get some feedback about what a minimal
plugin architecture would be.

I understand that I am yet to convince people of the merits of either
git -mediated plugin management or package management, so let's assume
that the contents of a "git-plugins" directory is managed only by
package managers or plugin authors, following guidelines established
by git-core.

I observed that Pau, Junio and Jonathan are receptive to the idea of a
"standard" directory into which plugins could be installed. Pau would
prefer one directory per package, and with that I would concur.

However, let's start simple, what would a minimal plugin directory
look like and, assuming there was one per git-install, where would it
be located relative to the prefix?

Here's a suggestion for the layout:

bin/
   - all scripts and sh libraries
man/
   - all man pages
html/
   - all html pages

What about location?

   ${prefix}/git-plugins
   ${prefix}/lib/git-plugins

Or, decided by distribution?

Is there support for the idea of adding a --man-path switch to the main line?

What about a --plugins-path, that would answer the question about
where plugins should go?

Per Jonathan's and Junio's suggestions, the idea of having a plugins
search path seems like a reasonable one, so that users without control
over the git install can at least customize it themselves.

How would this path be configured by the user? Would the user
configuration edit the git default or would it override it?

If there are multiple plugin directories, how would a plugin discover
which one it has been installed in so that it can find any
plugin-specific resource it might need?

Regards,

jon.

```

## david@lang.hm, 2011-04-29 01:12

Subject: Re: RFC: a minimal plugin architecture
Message-ID: <alpine.DEB.2.00.1104281808490.7120@asgard.lang.hm>
URL: https://gitlist.dev/e/alpine.DEB.2.00.1104281808490.7120%40asgard.lang.hm
In-Reply-To: <BANLkTi=53dShgcsyTUP2aA+hvm6p+93XrA@mail.gmail.com>

```
On Fri, 29 Apr 2011, Jon Seymour wrote:

> However, let's start simple, what would a minimal plugin directory
> look like and, assuming there was one per git-install, where would it
> be located relative to the prefix?
>
> Here's a suggestion for the layout:
>
> bin/
>   - all scripts and sh libraries
> man/
>   - all man pages
> html/
>   - all html pages
>
> What about location?
>
>   ${prefix}/git-plugins
>   ${prefix}/lib/git-plugins
>
> Or, decided by distribution?

distros are going to change this anyway, so start by accepting that, then 
make the default just that, a default, not something hard-coded.

> Is there support for the idea of adding a --man-path switch to the main line?
>
> What about a --plugins-path, that would answer the question about
> where plugins should go?

I think it would be better to put it in the config file, nobody is going 
to add command line options to every command they run.

> Per Jonathan's and Junio's suggestions, the idea of having a plugins
> search path seems like a reasonable one, so that users without control
> over the git install can at least customize it themselves.

only if you make sure that the plugins only run as the user, with no 
chance of them being invoked as a privilaged user.

David Lang

> How would this path be configured by the user? Would the user
> configuration edit the git default or would it override it?
>
> If there are multiple plugin directories, how would a plugin discover
> which one it has been installed in so that it can find any
> plugin-specific resource it might need?
>
> Regards,
>
> jon.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

```

## Jon Seymour, 2011-04-29 01:29

Subject: Re: RFC: a minimal plugin architecture
Message-ID: <BANLkTi=zzMUoU+e=U6RzE7HPz-V=QkW+Hw@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTi%3DzzMUoU%2Be%3DU6RzE7HPz-V%3DQkW%2BHw%40mail.gmail.com
In-Reply-To: <alpine.DEB.2.00.1104281808490.7120@asgard.lang.hm>

```
On Fri, Apr 29, 2011 at 11:12 AM,  <david@lang.hm> wrote:
> On Fri, 29 Apr 2011, Jon Seymour wrote:
>
>> However, let's start simple, what would a minimal plugin directory
>> look like and, assuming there was one per git-install, where would it
>> be located relative to the prefix?
>>
>> Here's a suggestion for the layout:
>>
>> bin/
>>  - all scripts and sh libraries
>> man/
>>  - all man pages
>> html/
>>  - all html pages
>>
>> What about location?
>>
>>  ${prefix}/git-plugins
>>  ${prefix}/lib/git-plugins
>>
>> Or, decided by distribution?
>
> distros are going to change this anyway, so start by accepting that, then
> make the default just that, a default, not something hard-coded.
>

Yep. Hopefully whatever the distro decided path would be available via
a git --plugins-path switch?

Might not be necessary if we let plugins install into --exec-path,
--html-path and (proposed) --man-path.

>> Is there support for the idea of adding a --man-path switch to the main
>> line?
>>
>> What about a --plugins-path, that would answer the question about
>> where plugins should go?
>
> I think it would be better to put it in the config file, nobody is going to
> add command line options to every command they run.

The intent here is to help package managers and plugin authors to
decide where they place plugin artifacts like scripts and others
resources. Similar to the existing --html-path and --exec-path
options.

>
>> Per Jonathan's and Junio's suggestions, the idea of having a plugins
>> search path seems like a reasonable one, so that users without control
>> over the git install can at least customize it themselves.
>
> only if you make sure that the plugins only run as the user, with no chance
> of them being invoked as a privilaged user.
>

Sure.

Thank you!

jon.

```
