Closed GoogleCodeExporter closed 9 years ago
Unfortunately, as far as I can see JGit does not (yet) support --shared.
Original comment by James.Mo...@gmail.com
on 2 Jul 2013 at 3:57
So, do you think you could work around that by directly setting the config
variable "core.sharedRepository" and maybe even "receive.denyNonFastForwards"
with JGit Config methods?
Original comment by f.zscho...@gmail.com
on 3 Jul 2013 at 12:52
Yes, I can manipulate the repo config and I can use JNA to workaround Java 6
limitations in setting unix filesystem permissions to emulate what you
describe, but I'm not comfortable making this change for the next release which
should be out in a day or two.
If you need this now then I recommend creating the repos from outside Gitblit
and clearing Gitblit's cache afterwards so that it sees your new repo(s).
You want --shared because you are cloning/pushing these repos with file://
urls, right?
BTW, while I can set "receive.denyNonFastForwards" for other Git tooling,
Gitblit does not respect this setting.
Original comment by James.Mo...@gmail.com
on 3 Jul 2013 at 1:32
No, I want shared because I use Gitblit for creating/forking repositories but
not as the exclusive access control tool. Access is also through Apache and via
SSH. So all repositories are owned by the git group and g+s.
Original comment by f.zscho...@gmail.com
on 3 Jul 2013 at 1:45
James, could you give me some pointers to the code I should be looking at in
order to "manipulate the repo config" and "use JNA to workaround Java 6
limitations in setting unix filesystem permissions"? I would like to start
working on this as it is my next most pressing issue for our installation.
Original comment by f.zscho...@gmail.com
on 12 Aug 2013 at 6:12
JNA is already a dependency so this should be less painful.
Below is half of what you want - setting the sharedRepository flag - and a hint
on how to do the remainder. The linked CLibrary api may not be the correct
one. The basic plan is to set the repo config and file system permissions
after the repository is init'd, since JGit doesn't support --shared.
JGitUtils.createRepository() {
try {
Git git = Git.init().setDirectory(new File(repositoriesFolder, name)).setBare(true).call();
boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") > -1;
if (!isWindows) {
StoredConfig config = git.getRepository().getConfig();
config.setBoolean("core", null, "sharedRepository", true);
config.save();
// JNA here
// http://stackoverflow.com/a/664453/830200
}
return git.getRepository();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (GitAPIException e) {
throw new RuntimeException(e);
}
}
Original comment by James.Mo...@gmail.com
on 12 Aug 2013 at 6:44
Merged to master
Original comment by James.Mo...@gmail.com
on 17 Sep 2013 at 9:57
1.4.0 released.
Original comment by James.Mo...@gmail.com
on 9 Mar 2014 at 6:06
Original issue reported on code.google.com by
f.zscho...@gmail.com
on 2 Jul 2013 at 3:32