org.eclipse.jgit.lib.Repository.writeOrigHead()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.eclipse.jgit.lib.Repository.writeOrigHead方法的一些代码示例,展示了Repository.writeOrigHead的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.writeOrigHead方法的具体详情如下:
包路径:org.eclipse.jgit.lib.Repository
类名称:Repository
方法名:writeOrigHead

Repository.writeOrigHead介绍

[英]Write original HEAD commit into $GIT_DIR/ORIG_HEAD.
[中]将原始头提交写入$GIT_DIR/ORIG_HEAD。

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

private void resetSoftToParent() throws IOException,
    GitAPIException, CheckoutConflictException {
  Ref ref = repo.exactRef(Constants.ORIG_HEAD);
  ObjectId orig_head = ref == null ? null : ref.getObjectId();
  try (Git git = Git.wrap(repo)) {
    // we have already committed the cherry-picked commit.
    // what we need is to have changes introduced by this
    // commit to be on the index
    // resetting is a workaround
    git.reset().setMode(ResetType.SOFT)
        .setRef("HEAD~1").call(); //$NON-NLS-1$
  } finally {
    // set ORIG_HEAD back to where we started because soft
    // reset moved it
    repo.writeOrigHead(orig_head);
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

repo.writeOrigHead(origHead);

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

repo.writeOrigHead(headId);
rebaseState.createFile(REBASE_HEAD, headId.name());
rebaseState.createFile(HEAD_NAME, headName);

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

private void resetSoftToParent() throws IOException,
    GitAPIException, CheckoutConflictException {
  Ref ref = repo.exactRef(Constants.ORIG_HEAD);
  ObjectId orig_head = ref == null ? null : ref.getObjectId();
  try {
    // we have already commited the cherry-picked commit.
    // what we need is to have changes introduced by this
    // commit to be on the index
    // resetting is a workaround
    Git.wrap(repo).reset().setMode(ResetType.SOFT)
        .setRef("HEAD~1").call(); //$NON-NLS-1$
  } finally {
    // set ORIG_HEAD back to where we started because soft
    // reset moved it
    repo.writeOrigHead(orig_head);
  }
}

代码示例来源:origin: berlam/github-bucket

private void resetSoftToParent() throws IOException,
    GitAPIException, CheckoutConflictException {
  Ref ref = repo.exactRef(Constants.ORIG_HEAD);
  ObjectId orig_head = ref == null ? null : ref.getObjectId();
  try (Git git = Git.wrap(repo)) {
    // we have already committed the cherry-picked commit.
    // what we need is to have changes introduced by this
    // commit to be on the index
    // resetting is a workaround
    git.reset().setMode(ResetType.SOFT)
        .setRef("HEAD~1").call(); //$NON-NLS-1$
  } finally {
    // set ORIG_HEAD back to where we started because soft
    // reset moved it
    repo.writeOrigHead(orig_head);
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

repo.writeOrigHead(origHead);

代码示例来源:origin: berlam/github-bucket

repo.writeOrigHead(origHead);

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

repo.writeOrigHead(headId);
rebaseState.createFile(REBASE_HEAD, headId.name());
rebaseState.createFile(HEAD_NAME, headName);

代码示例来源:origin: berlam/github-bucket

repo.writeOrigHead(headId);
rebaseState.createFile(REBASE_HEAD, headId.name());
rebaseState.createFile(HEAD_NAME, headName);

相关文章

Repository类方法