summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/gitblit/tests/JGitUtilsTest.java
diff options
context:
space:
mode:
authorFlorian Zschocke <florian.zschocke@cycos.com>2013-08-20 21:20:17 +0200
committerFlorian Zschocke <florian.zschocke@cycos.com>2013-08-26 12:39:57 +0200
commit8b5730a0e32d5707b6ac6df5fb0906b7981853eb (patch)
tree84f5fbbaaa89d3084ae368c0c99b2a2ed2805c84 /src/test/java/com/gitblit/tests/JGitUtilsTest.java
parent9d83a080fc0c24770a079c02b83b8141ddbb6534 (diff)
downloadgitblit-8b5730a0e32d5707b6ac6df5fb0906b7981853eb.tar.gz
gitblit-8b5730a0e32d5707b6ac6df5fb0906b7981853eb.zip
Fix setting wrrong custom mode on file and in config.
Diffstat (limited to 'src/test/java/com/gitblit/tests/JGitUtilsTest.java')
-rw-r--r--src/test/java/com/gitblit/tests/JGitUtilsTest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/java/com/gitblit/tests/JGitUtilsTest.java b/src/test/java/com/gitblit/tests/JGitUtilsTest.java
index f18c05f8..cdf698d6 100644
--- a/src/test/java/com/gitblit/tests/JGitUtilsTest.java
+++ b/src/test/java/com/gitblit/tests/JGitUtilsTest.java
@@ -183,6 +183,42 @@ public class JGitUtilsTest {
}
@Test
+ public void testCreateRepositorySharedCustom() throws Exception {
+ String[] repositories = { "NewSharedTestRepository.git" };
+ for (String repositoryName : repositories) {
+ Repository repository = JGitUtils.createRepository(GitBlitSuite.REPOSITORIES,
+ repositoryName, "660");
+ File folder = FileKey.resolve(new File(GitBlitSuite.REPOSITORIES, repositoryName),
+ FS.DETECTED);
+ assertNotNull(repository);
+ assertFalse(JGitUtils.hasCommits(repository));
+ assertNull(JGitUtils.getFirstCommit(repository, null));
+
+ assertEquals("0660", repository.getConfig().getString("core", null, "sharedRepository"));
+
+ assertTrue(folder.exists());
+ if (! JnaUtils.isWindows()) {
+ int mode = JnaUtils.getFilemode(folder);
+ assertEquals(JnaUtils.S_ISGID, mode & JnaUtils.S_ISGID);
+ assertEquals(JnaUtils.S_IRWXG, mode & JnaUtils.S_IRWXG);
+ assertEquals(0, mode & JnaUtils.S_IRWXO);
+
+ mode = JnaUtils.getFilemode(folder.getAbsolutePath() + "/HEAD");
+ assertEquals(JnaUtils.S_IRGRP | JnaUtils.S_IWGRP, mode & JnaUtils.S_IRWXG);
+ assertEquals(0, mode & JnaUtils.S_IRWXO);
+
+ mode = JnaUtils.getFilemode(folder.getAbsolutePath() + "/config");
+ assertEquals(JnaUtils.S_IRGRP | JnaUtils.S_IWGRP, mode & JnaUtils.S_IRWXG);
+ assertEquals(0, mode & JnaUtils.S_IRWXO);
+ }
+
+ repository.close();
+ RepositoryCache.close(repository);
+ FileUtils.delete(repository.getDirectory(), FileUtils.RECURSIVE);
+ }
+ }
+
+ @Test
public void testRefs() throws Exception {
Repository repository = GitBlitSuite.getJGitRepository();
Map<ObjectId, List<RefModel>> map = JGitUtils.getAllRefs(repository);