git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] When re-initializing, set shared permissions on all directories.
@ 2007-11-21  3:48 Jon Jensen
  2007-11-21  6:45 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Jensen @ 2007-11-21  3:48 UTC (permalink / raw)
  To: git

Hi.

Below is a small patch to make git-init --shared change permissions not 
just of .git/refs/ but of the other directories too.

Also a documentation patch for git-init, though after reading discussion 
in the list archives from a few weeks ago, I realize people may not be 
interested in documentation that shows explicit UNIX commands that may not 
apply or could be considered pedantic. Let me know if there's a better way 
I can approach this.

Thanks,
Jon


--
From b2895649165d7e6c4bcbe6484d66c84ea7124bd9 Mon Sep 17 00:00:00 2001
From: Jon Jensen <jon@endpoint.com>
Date: Tue, 20 Nov 2007 20:01:14 -0700
Subject: [PATCH] When re-initializing, set shared permissions on all directories.

Before this patch, when re-initializing an existing repository e.g.
as --shared=group, only .git/refs/ was set chmod g+ws. Now the
other directories get that too.

This is probably only helpful when not much has been done with the
repository yet, since it doesn't include subdirectories and files,
so add an example to the documentation to point the way for people
to finish the job.
---
  Documentation/git-init.txt |   13 +++++++++++++
  builtin-init-db.c          |    8 +++++++-
  2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index 07484a4..c4a4757 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -101,6 +101,19 @@ $ git-add .     <2>
  <2> add all existing file to the index


+Adjust an existing git repository to work as if it had been created with git init --shared::
++
+----------------
+$ GIT_DIR=/path/to/my/.git git-init --shared  <1>
+$ chgrp -R mygroup /path/to/my/.git  <2>
+$ find /path/to/my/.git -type d -exec chmod g+ws {} \;  <3>
+----------------
++
+<1> adjust configuration for shared repository
+<2> correct group ownership of any existing directories and files; needed if group shared by users is different than the group ownership of repository files
+<3> make all directories set group ownership of newly created files correctly in the future
+
+
  Author
  ------
  Written by Linus Torvalds <torvalds@osdl.org>
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 763fa55..d16efa5 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -24,7 +24,13 @@ static void safe_create_dir(const char *dir, int share)
  			exit(1);
  		}
  	}
-	else if (share && adjust_shared_perm(dir))
+
+    /*
+     * If the directory already existed, we may still need
+     * to adjust permissions if this is a reinitialization
+     * for a shared repository.
+     */
+	if (share && adjust_shared_perm(dir))
  		die("Could not make %s writable by group\n", dir);
  }

-- 
1.5.3.6.737.gb2895

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

end of thread, other threads:[~2007-11-21  6:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21  3:48 [PATCH] When re-initializing, set shared permissions on all directories Jon Jensen
2007-11-21  6:45 ` Junio C Hamano

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).