Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.commit()


    File f = writeTrashFile("symlink", "content");
    Git git = new Git(db);
    db.getConfig().setString(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_SYMLINKS, "false");
    git.add().addFilepattern("symlink").call();
    git.commit().setMessage("commit").call();

    // Modify previously committed DirCacheEntry and write it back to disk
    DirCacheEntry dce = db.readDirCache().getEntry("symlink");
    dce.setFileMode(FileMode.SYMLINK);
    DirCacheCheckout.checkoutEntry(db, f, dce);
View Full Code Here


  @Test
  public void submoduleHeadMatchesIndex() throws Exception {
    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    final RevCommit id = git.commit().setMessage("create file").call();
    final String path = "sub";
    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {
View Full Code Here

  @Test
  public void submoduleWithNoGitDirectory() throws Exception {
    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    final RevCommit id = git.commit().setMessage("create file").call();
    final String path = "sub";
    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {
View Full Code Here

  @Test
  public void submoduleWithNoHead() throws Exception {
    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    final RevCommit id = git.commit().setMessage("create file").call();
    final String path = "sub";
    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {
View Full Code Here

  @Test
  public void submoduleDirectoryIterator() throws Exception {
    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    final RevCommit id = git.commit().setMessage("create file").call();
    final String path = "sub";
    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {
View Full Code Here

  @Test
  public void submoduleNestedWithHeadMatchingIndex() throws Exception {
    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    final RevCommit id = git.commit().setMessage("create file").call();
    final String path = "sub/dir1/dir2";
    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {
View Full Code Here

  @Test
  public void resolvePreviousBranch() throws Exception {
    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    RevCommit c1 = git.commit().setMessage("create file").call();
    writeTrashFile("file.txt", "content2");
    git.add().addFilepattern("file.txt").call();
    RevCommit c2 = git.commit().setMessage("edit file").call();

    git.checkout().setCreateBranch(true).setName("newbranch")
View Full Code Here

    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    RevCommit c1 = git.commit().setMessage("create file").call();
    writeTrashFile("file.txt", "content2");
    git.add().addFilepattern("file.txt").call();
    RevCommit c2 = git.commit().setMessage("edit file").call();

    git.checkout().setCreateBranch(true).setName("newbranch")
        .setStartPoint(c1).call();

    git.checkout().setName(c1.getName()).call();
View Full Code Here

  @Test
  public void resolveDate() throws Exception {
    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    git.commit().setMessage("create file").call();
    try {
      db.resolve("master@{yesterday}");
      fail("Exception not thrown");
    } catch (RevisionSyntaxException e) {
      assertNotNull(e);
View Full Code Here

    FileRepository submoduleStandalone = createWorkRepository();
    JGitTestUtil.writeTrashFile(submoduleStandalone, "fileInSubmodule",
        "submodule");
    Git submoduleStandaloneGit = Git.wrap(submoduleStandalone);
    submoduleStandaloneGit.add().addFilepattern("fileInSubmodule").call();
    submoduleStandaloneGit.commit().setMessage("add file to submodule")
        .call();

    submodule_db = (FileRepository) Git.wrap(db).submoduleAdd()
        .setPath("submodule")
        .setURI(submoduleStandalone.getDirectory().toURI().toString())
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.