git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Restricting access to a branch
@ 2008-05-21 23:36 Stephen Hemminger
  2008-05-22  0:17 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2008-05-21 23:36 UTC (permalink / raw)
  To: git

Is there some standard way to freeze a branch and not allow anymore changes to
be pushed?

Yes, I know it is possible by playing with hook files, but that doesn't seem
very admin friendly.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Restricting access to a branch
  2008-05-21 23:36 Restricting access to a branch Stephen Hemminger
@ 2008-05-22  0:17 ` Junio C Hamano
  2008-05-22  0:37   ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-05-22  0:17 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: git

Stephen Hemminger <shemminger@vyatta.com> writes:

> Is there some standard way to freeze a branch and not allow anymore changes to
> be pushed?
>
> Yes, I know it is possible by playing with hook files, but that doesn't seem
> very admin friendly.

If you do not want to use hooks, then the answer is no.  Sorry.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Restricting access to a branch
  2008-05-22  0:17 ` Junio C Hamano
@ 2008-05-22  0:37   ` Linus Torvalds
  2008-05-22  1:43     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2008-05-22  0:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Stephen Hemminger, git



On Wed, 21 May 2008, Junio C Hamano wrote:

> Stephen Hemminger <shemminger@vyatta.com> writes:
> 
> > Is there some standard way to freeze a branch and not allow anymore changes to
> > be pushed?
> >
> > Yes, I know it is possible by playing with hook files, but that doesn't seem
> > very admin friendly.
> 
> If you do not want to use hooks, then the answer is no.  Sorry.

Hmm. I don't think that's strictly true.

What you *can* do is:

 - rename the branch to something that includes a slash (aka 
   subdirectory). Let's call it "frozen/mybranch" as an example.

 - do a 'git gc' to make sure that branch is in the packed refs file.

 - make the subdirectory of that branch is unwritable (ie just do 
   something like "chmod -w refs/heads/frozen")

and now the filesystem permissions should mean that you can't actually 
update that branch any more, even though you can read it.

Of course, if the person has full shell access, then they can still just 
undo those file permissions, but at least it should be protected from 
accidentally being overwritten.

This is all totally untested, of course.

		Linus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Restricting access to a branch
  2008-05-22  0:37   ` Linus Torvalds
@ 2008-05-22  1:43     ` Junio C Hamano
  2008-05-22  8:16       ` Jakub Narebski
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-05-22  1:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Stephen Hemminger, git

Linus Torvalds <torvalds@linux-foundation.org> writes:

> What you *can* do is:
>
>  - rename the branch to something that includes a slash (aka 
>    subdirectory). Let's call it "frozen/mybranch" as an example.
>
>  - do a 'git gc' to make sure that branch is in the packed refs file.
>
>  - make the subdirectory of that branch is unwritable (ie just do 
>    something like "chmod -w refs/heads/frozen")
>
> and now the filesystem permissions should mean that you can't actually 
> update that branch any more, even though you can read it.

Hmmmmm... and deleting of the branch would take the same lock used for
updating, which is under frozen/ directory, so that is also safe.

That's sneaky.

I'd however throw that into "happens to work, unsure if we would want to
promise supporting it as a _feature_ forever" category.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Restricting access to a branch
  2008-05-22  1:43     ` Junio C Hamano
@ 2008-05-22  8:16       ` Jakub Narebski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2008-05-22  8:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Linus Torvalds, Stephen Hemminger, git

Junio C Hamano <gitster@pobox.com> writes:

> Linus Torvalds <torvalds@linux-foundation.org> writes:
> 
> > What you *can* do is:
> >
> >  - rename the branch to something that includes a slash (aka 
> >    subdirectory). Let's call it "frozen/mybranch" as an example.
> >
> >  - do a 'git gc' to make sure that branch is in the packed refs file.
> >
> >  - make the subdirectory of that branch is unwritable (ie just do 
> >    something like "chmod -w refs/heads/frozen")
> >
> > and now the filesystem permissions should mean that you can't actually 
> > update that branch any more, even though you can read it.
> 
> Hmmmmm... and deleting of the branch would take the same lock used for
> updating, which is under frozen/ directory, so that is also safe.
> 
> That's sneaky.
> 
> I'd however throw that into "happens to work, unsure if we would want to
> promise supporting it as a _feature_ forever" category.

Another solution would be to make it lightweight tag, i.e. change if
from refs/heads/somebranch to refs/tags/somebranch (by tagging, for
example).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-22  8:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 23:36 Restricting access to a branch Stephen Hemminger
2008-05-22  0:17 ` Junio C Hamano
2008-05-22  0:37   ` Linus Torvalds
2008-05-22  1:43     ` Junio C Hamano
2008-05-22  8:16       ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).