diff options
author | Florian Zschocke <florian.zschocke@cycos.com> | 2013-08-20 10:58:51 +0200 |
---|---|---|
committer | Florian Zschocke <florian.zschocke@cycos.com> | 2013-08-26 12:39:57 +0200 |
commit | e85277e1de9f59ac45df5ffd84c5d9be0e4d20d2 (patch) | |
tree | 0c371efe6681d13d036d7bff9f7d41e9c59fab46 /src/test/java/com | |
parent | 8a67d9dcdcc63fe48c97e83ffbc2a643eee2ed60 (diff) | |
download | gitblit-e85277e1de9f59ac45df5ffd84c5d9be0e4d20d2.tar.gz gitblit-e85277e1de9f59ac45df5ffd84c5d9be0e4d20d2.zip |
Implement adjusting file permissions for shared repositories.
Implement adjusting file and directory permissions for shared
repositories in JGitUtils.
Diffstat (limited to 'src/test/java/com')
-rw-r--r-- | src/test/java/com/gitblit/tests/JGitUtilsTest.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/test/java/com/gitblit/tests/JGitUtilsTest.java b/src/test/java/com/gitblit/tests/JGitUtilsTest.java index 4affca2d..6f86b9f7 100644 --- a/src/test/java/com/gitblit/tests/JGitUtilsTest.java +++ b/src/test/java/com/gitblit/tests/JGitUtilsTest.java @@ -52,6 +52,7 @@ import com.gitblit.models.PathModel.PathChangeModel; import com.gitblit.models.RefModel;
import com.gitblit.utils.CompressionUtils;
import com.gitblit.utils.JGitUtils;
+import com.gitblit.utils.JnaUtils;
import com.gitblit.utils.StringUtils;
public class JGitUtilsTest {
@@ -150,7 +151,7 @@ public class JGitUtilsTest { @Test
public void testCreateRepositoryShared() throws Exception {
- String[] repositories = { "NewTestRepository.git", "NewTestRepository" };
+ String[] repositories = { "NewSharedTestRepository.git" };
for (String repositoryName : repositories) {
Repository repository = JGitUtils.createRepository(GitBlitSuite.REPOSITORIES,
repositoryName, "group");
@@ -159,13 +160,21 @@ public class JGitUtilsTest { assertNotNull(repository);
assertFalse(JGitUtils.hasCommits(repository));
assertNull(JGitUtils.getFirstCommit(repository, null));
- assertEquals(folder.lastModified(), JGitUtils.getFirstChange(repository, null)
- .getTime());
- assertEquals(folder.lastModified(), JGitUtils.getLastChange(repository).when.getTime());
- assertNull(JGitUtils.getCommit(repository, null));
+
+ assertTrue(folder.exists());
+ int mode = JnaUtils.getFilemode(folder);
+ assertEquals(JnaUtils.S_ISGID, mode & JnaUtils.S_ISGID);
+ assertEquals(JnaUtils.S_IRWXG, mode & JnaUtils.S_IRWXG);
+
+ mode = JnaUtils.getFilemode(folder.getAbsolutePath() + "/HEAD");
+ assertEquals(JnaUtils.S_IRGRP | JnaUtils.S_IWGRP, mode & JnaUtils.S_IRWXG);
+
+ mode = JnaUtils.getFilemode(folder.getAbsolutePath() + "/config");
+ assertEquals(JnaUtils.S_IRGRP | JnaUtils.S_IWGRP, mode & JnaUtils.S_IRWXG);
+
repository.close();
RepositoryCache.close(repository);
-// FileUtils.delete(repository.getDirectory(), FileUtils.RECURSIVE);
+ FileUtils.delete(repository.getDirectory(), FileUtils.RECURSIVE);
}
}
|