[PATCH] When re-initializing, set shared permissions on all directories.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
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@xxxxxxxx>
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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux