# Can I enforce required approval on some files

6 messages from 2010-07-20 to 2010-07-21. Participants: Dominik Gront, Sylvain Rabot, Bruce Stephens, Jakub Narebski, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/24449

## Dominik Gront, 2010-07-20 20:22

Subject: Can I enforce required approval on some files
Message-ID: <AANLkTinQI9eBnwjzPhYHMM8XZ0ODfHJ1qiZJrNWQWUno@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTinQI9eBnwjzPhYHMM8XZ0ODfHJ1qiZJrNWQWUno%40mail.gmail.com

```
Dear Group,

I have been a happy SVN user for quite a long time, but now I miss
some functionality in Subversion. I wonder if it could be done in git.
If so, I convert to git right away :-)

There are some files in our repository that all their modification
need to be approved by a project leader.  In general the desired
behavior would be (examples given in svn commands) :
- user runs "svn ci"
- some files have status "pending" or "waiting for approval"
- anyone can do "svn up", modifications to the pending files are not
retrieved, project leader can get the modified versions
- project leader accepts the changes
- anyone running "svn ci" sees all the modifications

Best,
Tim

```

## Bruce Stephens, 2010-07-20 20:45

Subject: Re: Can I enforce required approval on some files
Message-ID: <80pqyhc27m.fsf@tiny.isode.net>
URL: https://gitlist.dev/e/80pqyhc27m.fsf%40tiny.isode.net
In-Reply-To: <AANLkTinQI9eBnwjzPhYHMM8XZ0ODfHJ1qiZJrNWQWUno@mail.gmail.com>

```
Dominik Gront <dgront@gmail.com> writes:

> I have been a happy SVN user for quite a long time, but now I miss
> some functionality in Subversion. I wonder if it could be done in git.
> If so, I convert to git right away :-)
>
> There are some files in our repository that all their modification
> need to be approved by a project leader.

Either have the repository owned by someone who'll do whatever checking
you want (which seems to be common at least amongst the public projects)
or use hooks in a shared repository.  Specifically the update hook.

The hook can do whatever checking you deem appropriate.  At work we have
it check the commit message for Signed-off-by names (in our context it
really means Reviewed-by; we use sob because that's more convenient to
add).  The hook could look at which files are changed or whatever else
you wanted.  (Notice it gets called to update a ref, and that may
involve more than one commit, so be sure to check all the relevant
commits.)

[...]

```

## Sylvain Rabot, 2010-07-20 20:45

Subject: Re: Can I enforce required approval on some files
Message-ID: <1279658706.2519.12.camel@kheops>
URL: https://gitlist.dev/e/1279658706.2519.12.camel%40kheops
In-Reply-To: <AANLkTinQI9eBnwjzPhYHMM8XZ0ODfHJ1qiZJrNWQWUno@mail.gmail.com>

```
On Tue, 2010-07-20 at 13:22 -0700, Dominik Gront wrote:
> Dear Group,
> 
> I have been a happy SVN user for quite a long time, but now I miss
> some functionality in Subversion. I wonder if it could be done in git.
> If so, I convert to git right away :-)
> 
> There are some files in our repository that all their modification
> need to be approved by a project leader.  In general the desired
> behavior would be (examples given in svn commands) :
> - user runs "svn ci"
> - some files have status "pending" or "waiting for approval"
> - anyone can do "svn up", modifications to the pending files are not
> retrieved, project leader can get the modified versions
> - project leader accepts the changes
> - anyone running "svn ci" sees all the modifications
> 
> Best,
> Tim

Hi,

Git itself does not allow what you want but the workflow used to work
with git does. 

Each developer work and on a "copy" of the "blessed" repository (the one
checked out in svn, cloned in git) so it does not matter if
modifications done to a file need approval or not. Once the developer is
happy with his work he has to send his commit(s) to the person(s) in
charge of maintaining the project and this/those people will review the
changes and push (commit in svn language) them to the "blessed"
repository if they are ok with the changes made.

With git, if not used like svn, all modifications need approval.

You can read more about git's distributed workflow here :
http://progit.org/book/ch5-1.html

Regards.

-- 
Sylvain Rabot <sylvain@abstraction.fr>

```

## Jakub Narebski, 2010-07-20 22:03

Subject: Re: Can I enforce required approval on some files
Message-ID: <m36309n75a.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m36309n75a.fsf%40localhost.localdomain
In-Reply-To: <AANLkTinQI9eBnwjzPhYHMM8XZ0ODfHJ1qiZJrNWQWUno@mail.gmail.com>

```
Dominik Gront <dgront@gmail.com> writes:

> I have been a happy SVN user for quite a long time, but now I miss
> some functionality in Subversion. I wonder if it could be done in git.
> If so, I convert to git right away :-)
> 
> There are some files in our repository that all their modification
> need to be approved by a project leader.  In general the desired
> behavior would be (examples given in svn commands) :
> - user runs "svn ci"
> - some files have status "pending" or "waiting for approval"
> - anyone can do "svn up", modifications to the pending files are not
>   retrieved, project leader can get the modified versions
> - project leader accepts the changes
> - anyone running "svn ci" sees all the modifications

Besides solution mentioned by others, namely integration repository
with moderator, you can also use patch/commit code review tool such as
Gerrit (http://code.google.com/p/gerrit/), equivalent of Rietveld for
Subversion, or Mondrian for Perforce.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Ævar Arnfjörð Bjarmason, 2010-07-21 00:42

Subject: Re: Can I enforce required approval on some files
Message-ID: <AANLkTilWzSU9Uh0QT5CcauXiiBKtkG37To57s6zUxzDK@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTilWzSU9Uh0QT5CcauXiiBKtkG37To57s6zUxzDK%40mail.gmail.com
In-Reply-To: <m36309n75a.fsf@localhost.localdomain>

```
On Tue, Jul 20, 2010 at 22:03, Jakub Narebski <jnareb@gmail.com> wrote:

> Besides solution mentioned by others, namely integration repository
> with moderator, you can also use patch/commit code review tool such as
> Gerrit (http://code.google.com/p/gerrit/), equivalent of Rietveld for
> Subversion, or Mondrian for Perforce.

There's also the low-tech solution of just telling people to submit
again until their patches don't suck, it works for git.git, and is
attainable when you're not doing a centralized tool.

```

## Jakub Narebski, 2010-07-21 07:51

Subject: Re: Can I enforce required approval on some files
Message-ID: <201007210951.25150.jnareb@gmail.com>
URL: https://gitlist.dev/e/201007210951.25150.jnareb%40gmail.com
In-Reply-To: <AANLkTilWzSU9Uh0QT5CcauXiiBKtkG37To57s6zUxzDK@mail.gmail.com>

```
On Wed, 21 Jul 2010, Ævar Arnfjörð Bjarmason wrote:
> On Tue, Jul 20, 2010 at 22:03, Jakub Narebski <jnareb@gmail.com> wrote:
> 
> > Besides solution mentioned by others, namely integration repository
> > with moderator, you can also use patch/commit code review tool such as
> > Gerrit (http://code.google.com/p/gerrit/), equivalent of Rietveld for
> > Subversion, or Mondrian for Perforce.
> 
> There's also the low-tech solution of just telling people to submit
> again until their patches don't suck, it works for git.git, and is
> attainable when you're not doing a centralized tool.

That's what I meant by "besides [...] integration repository with
moderator", moderator who reviews patches or pull requests, and accepts
into integration repository or rejects them.

-- 
Jakub Narebski
Poland

```
