Example usage for org.eclipse.jgit.lib Constants DOT_GIT

List of usage examples for org.eclipse.jgit.lib Constants DOT_GIT

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib Constants DOT_GIT.

Prototype

String DOT_GIT

To view the source code for org.eclipse.jgit.lib Constants DOT_GIT.

Click Source Link

Document

Default name for the Git repository directory

Usage

From source file:org.eclipse.egit.core.test.op.CreatePatchOperationTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    super.setUp();
    gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepository = new TestRepository(gitDir);
    testRepository.connect(project.getProject());

    file = testRepository.createFile(project.getProject(), "test-file");

    commit = testRepository.addAndCommit(project.getProject(), file, "new file");
}

From source file:org.eclipse.egit.core.test.op.CreatePatchOperationTest.java

License:Open Source License

@Test
public void testComputeWorkspacePathRepoAboveProject() throws Exception {
    testRepository.disconnect(project.getProject());

    // new setup// w  ww. j av a2  s .co m
    project = new TestProject(true, "repo/bundles/Project-1", true, null);
    File repo = new File(project.getProject().getLocationURI().getPath()).getParentFile().getParentFile();
    gitDir = new File(repo, Constants.DOT_GIT);
    testRepository = new TestRepository(gitDir);
    testRepository.connect(project.getProject());

    IPath oldPath = CreatePatchOperation.computeWorkspacePath(new Path("bundles/Project-1/test-file"),
            project.getProject());
    IPath newPath = CreatePatchOperation.computeWorkspacePath(new Path("bundles/Project-1/test-file"),
            project.getProject());
    assertPatch("test-file", oldPath.toString());
    assertPatch("test-file", newPath.toString());
}

From source file:org.eclipse.egit.core.test.op.DeletePathsOperationTest.java

License:Open Source License

@Before
public void setUp() throws Exception {

    workdir = testUtils.createTempDir("Repository1");

    repository1 = new TestRepository(new File(workdir, Constants.DOT_GIT));
    project = testUtils.createProjectInLocalFileSystem(workdir, projectName);
    repository1.connect(project);/*from   w ww .j  a  va  2  s .co m*/
}

From source file:org.eclipse.egit.core.test.op.DiscardChangesOperationTest.java

License:Open Source License

@Before
public void setUp() throws Exception {

    workdir = testUtils.createTempDir("Repository1");

    repository1 = new TestRepository(new File(workdir, Constants.DOT_GIT));

    // now we create a project in repo1
    project = testUtils.createProjectInLocalFileSystem(workdir, projectName);
    testUtils.addFileToProject(project, "folder1/file1.txt", "Hello world");

    repository1.connect(project);/*from   ww  w . ja va  2  s  .  com*/

    project.accept(new IResourceVisitor() {

        public boolean visit(IResource resource) throws CoreException {
            if (resource instanceof IFile) {
                try {
                    repository1.track(EFS.getStore(resource.getLocationURI()).toLocalFile(0, null));
                } catch (IOException e) {
                    throw new CoreException(Activator.error(e.getMessage(), e));
                }
            }
            return true;
        }
    });
    repository1.commit("Initial commit");
}

From source file:org.eclipse.egit.core.test.op.EditCommitOperationTest.java

License:Open Source License

@Override
@Before//from w ww  . j  a  v  a 2  s  .  co  m
public void setUp() throws Exception {
    super.setUp();
    gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepository = new TestRepository(gitDir);
    testRepository.connect(project.getProject());
    testRepository.createInitialCommit("initial");

    File file = testRepository.createFile(project.getProject(), "file");
    firstCommit = testRepository.addAndCommit(project.getProject(), file, "a commit");

    testRepository.appendFileContent(file, "some text");
    secondCommit = testRepository.addAndCommit(project.getProject(), file, "second commit");
}

From source file:org.eclipse.egit.core.test.op.ListRemoteOperationTest.java

License:Open Source License

/**
 * Set up repository1 with branch "master", create some project and commit
 * it; then clone into repository2; finally create a branch "test" on top of
 * "master" in repository2/*from   w w w . jav  a  2  s .  c  om*/
 *
 * @throws Exception
 */
@Before
public void setUp() throws Exception {

    workdir = testUtils.createTempDir("Repository1");
    workdir2 = testUtils.createTempDir("Repository2");

    repository1 = new TestRepository(new File(workdir, Constants.DOT_GIT));

    // now we create a project in repo1
    IProject project = testUtils.createProjectInLocalFileSystem(workdir, projectName);
    testUtils.addFileToProject(project, "folder1/file1.txt", "Hello world");

    repository1.connect(project);

    project.accept(new IResourceVisitor() {

        public boolean visit(IResource resource) throws CoreException {
            if (resource instanceof IFile) {
                try {
                    repository1.track(EFS.getStore(resource.getLocationURI()).toLocalFile(0, null));
                } catch (IOException e) {
                    throw new CoreException(Activator.error(e.getMessage(), e));
                }
            }
            return true;
        }
    });

    repository1.commit("Initial commit");

    // let's get rid of the project
    project.delete(false, false, null);

    // let's clone repository1 to repository2
    URIish uri = new URIish("file:///" + repository1.getRepository().getDirectory().toString());
    CloneOperation clop = new CloneOperation(uri, true, null, workdir2, "refs/heads/master", "origin", 0);
    clop.run(null);

    repository2 = new TestRepository(new FileRepository(new File(workdir2, Constants.DOT_GIT)));
    // we push to branch "test" of repository2
    RefUpdate createBranch = repository2.getRepository().updateRef("refs/heads/test");
    createBranch.setNewObjectId(repository2.getRepository().resolve("refs/heads/master"));
    createBranch.update();
}

From source file:org.eclipse.egit.core.test.op.MergeOperationTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    super.setUp();
    gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepository = new TestRepository(gitDir);
    testRepository.connect(project.getProject());

    File file1 = testRepository.createFile(project.getProject(), "file1-1");
    testRepository.addAndCommit(project.getProject(), file1, "master commit 1");
    testRepository.createBranch(MASTER, SIDE);
    testRepository.appendFileContent(file1, "file1-2");
    secondCommit = testRepository.addAndCommit(project.getProject(), file1, "master commit 2");
    testRepository.checkoutBranch(SIDE);
}

From source file:org.eclipse.egit.core.test.op.RemoveFromIndexOperationTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    super.setUp();
    gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepo = new TestRepository(gitDir);
    testRepo.connect(project.getProject());
    testRepo.commit("initial commit");

    project2 = new TestProject(true, "Project-2");
    gitDir2 = new File(project2.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepo2 = new TestRepository(gitDir2);
    testRepo2.connect(project2.getProject());
    testRepo2.commit("initial commit repo 2");
}

From source file:org.eclipse.egit.core.test.op.RewordCommitsOperationTest.java

License:Open Source License

@Override
@Before// w  ww.jav a2s.c  o  m
public void setUp() throws Exception {
    super.setUp();
    gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepository = new TestRepository(gitDir);
    testRepository.connect(project.getProject());
    testRepository.createInitialCommit("initial");

    File file = testRepository.createFile(project.getProject(), "file");
    commit = testRepository.addAndCommit(project.getProject(), file, "a commit");
}

From source file:org.eclipse.egit.core.test.op.StashCreateOperationTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    super.setUp();
    gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepository = new TestRepository(gitDir);
    repository = testRepository.getRepository();
    testRepository.connect(project.getProject());
    testRepository.commit("initial commit");
}