Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RefUpdate.link()


      return; // throw exception?

    if (head.getName().startsWith(Constants.R_HEADS)) {
      final RefUpdate newHead = repo.updateRef(Constants.HEAD);
      newHead.disableRefLog();
      newHead.link(head.getName());
      addMergeConfig(repo, head);
    }

    final RevCommit commit = parseCommit(repo, head);
View Full Code Here


      refUpdate.setForceUpdate(force);
      refUpdate.setRefLogMessage(refLogMessage + " to "
          + newCommit.getName(), false);
      Result updateResult;
      if (ref != null)
        updateResult = refUpdate.link(ref.getName());
      else {
        refUpdate.setNewObjectId(newCommit);
        updateResult = refUpdate.forceUpdate();
      }
View Full Code Here

      if (detach) { // Tag
        RevCommit commit = getCommit(repository, targetRef);
        head.setNewObjectId(commit.getId());
        result = head.forceUpdate();
      } else {
        result = head.link(targetRef);
      }
      switch (result) {
      case NEW:
      case FORCED:
      case NO_CHANGE:
View Full Code Here

    git.commit().setMessage("Initial commit").call();

    // create a master branch and switch to it
    git.branchCreate().setName("test").call();
    RefUpdate rup = db.updateRef(Constants.HEAD);
    rup.link("refs/heads/test");

    // tags
    git.tag().setName("tag1").call();
    git.tag().setName("tag2").call();
    git.tag().setName("tag3").call();
View Full Code Here

    FileUtils.mkdir(new File(getDirectory(), "branches")); //$NON-NLS-1$
    FileUtils.mkdir(new File(getDirectory(), "hooks")); //$NON-NLS-1$

    RefUpdate head = updateRef(Constants.HEAD);
    head.disableRefLog();
    head.link(Constants.R_HEADS + Constants.MASTER);

    final boolean fileMode;
    if (getFS().supportsExecute()) {
      File tmp = File.createTempFile("try", "execute", getDirectory()); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

    assertFalse(res.getTrackingRefUpdates().isEmpty());
    rup = localRepository.updateRef("refs/heads/master");
    rup.setNewObjectId(initialCommit.getId());
    rup.forceUpdate();
    rup = localRepository.updateRef(Constants.HEAD);
    rup.link("refs/heads/master");
    rup.setNewObjectId(initialCommit.getId());
    rup.update();
    return localGit;
  }
View Full Code Here

      return; // throw exception?

    if (head.getName().startsWith(Constants.R_HEADS)) {
      final RefUpdate newHead = clonedRepo.updateRef(Constants.HEAD);
      newHead.disableRefLog();
      newHead.link(head.getName());
      addMergeConfig(clonedRepo, head);
    }

    final RevCommit commit = parseCommit(clonedRepo, head);
View Full Code Here

public class RefUpdateTest extends SampleDataRepositoryTestCase {

  private void writeSymref(String src, String dst) throws IOException {
    RefUpdate u = db.updateRef(src);
    switch (u.link(dst)) {
    case NEW:
    case FORCED:
    case NO_CHANGE:
      break;
    default:
View Full Code Here

    dco.checkout();
    walk.release();
    // update the HEAD
    RefUpdate refUpdate = db.updateRef(Constants.HEAD);
    refUpdate.setRefLogMessage("checkout: moving to " + branchName, false);
    refUpdate.link(branchName);
  }

  /**
   * Writes a number of files in the working tree. The first content specified
   * will be written into a file named '0', the second into a file named "1"
View Full Code Here

  private boolean linkHEAD(RefUpdate target) {
    try {
      RefUpdate u = refdb.newUpdate(Constants.HEAD, false);
      u.disableRefLog();
      switch (u.link(target.getName())) {
      case NEW:
      case FORCED:
      case NO_CHANGE:
        return true;
      default:
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.