org.eclipse.jgit.lib.AbbreviatedObjectId Java Examples

The following examples show how to use org.eclipse.jgit.lib.AbbreviatedObjectId. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdaterGenerator.java    From neembuu-uploader with GNU General Public License v3.0 6 votes vote down vote up
private void checkDiffEmpty(List<DiffEntry> diffs){
    if (diffs.isEmpty()) {
        System.out.println("No diff");
    } else {
        System.out.println("Check if there are plugins to update");
        for (DiffEntry entry : diffs) {
            String editFilePath = entry.getPath(DiffEntry.Side.NEW);
            if (editFilePath.contains("neembuu-uploader-uploaders/src/neembuu/uploader/uploaders")) {
                AbbreviatedObjectId newId = entry.getNewId();
                String sha = newId.name();
                pluginsToUpdate.add(new PluginToUpdate(new File(gitDirectory, editFilePath), sha));
                System.out.println(sha + " -> " + editFilePath);
            }
        }
    }
}
 
Example #2
Source File: DiffingLines.java    From SZZUnleashed with MIT License 5 votes vote down vote up
/**
 * Extract the RawText object from a id.
 *
 * @param id the id on the object, which in this case is a commit.
 * @return either null or a RawText object.
 */
private RawText toRaw(AbbreviatedObjectId id) {
  try {
    ObjectLoader loader = this.repo.open(id.toObjectId());
    return RawText.load(loader, PackConfig.DEFAULT_BIG_FILE_THRESHOLD);
  } catch (Exception e) {
    return null;
  }
}
 
Example #3
Source File: RebaseTodoUtils.java    From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static List<RebaseTodoLine> parseLines(List<RebaseResponse.RebaseTodoLine> lines) {
    List<RebaseTodoLine> rebaseTodoLines = new ArrayList<>();

    for (RebaseResponse.RebaseTodoLine line : lines) {
        RebaseTodoLine rebaseTodoLine = new RebaseTodoLine(
                RebaseTodoLine.Action.valueOf(line.getAction().name()),
                AbbreviatedObjectId.fromString(line.getCommit()),
                line.getShortMessage());

        rebaseTodoLines.add(rebaseTodoLine);
    }

    return rebaseTodoLines;
}
 
Example #4
Source File: JGitTemplate.java    From piper with Apache License 2.0 5 votes vote down vote up
private IdentifiableResource readBlob (Repository aRepo, String aPath, String aBlobId) throws Exception {
  try (ObjectReader reader = aRepo.newObjectReader()) {
    if(aBlobId.equals(LATEST)) {
      List<IdentifiableResource> headFiles = getHeadFiles(aRepo, aPath);
      Assert.notEmpty(headFiles,"could not find: " + aPath + ":" + aBlobId);
      return headFiles.get(0);
    }
    ObjectId objectId = aRepo.resolve(aBlobId);
    Assert.notNull(objectId,"could not find: " + aPath + ":" + aBlobId);
    byte[] data = reader.open(objectId).getBytes();
    AbbreviatedObjectId abbreviated = reader.abbreviate(objectId);
    return new IdentifiableResource(aPath+":"+abbreviated.name(), new ByteArrayResource(data));
  }
}
 
Example #5
Source File: DiffHelper.java    From diff-check with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static byte[] writeGitLinkText(AbbreviatedObjectId id) {
    if (ObjectId.zeroId().equals(id.toObjectId())) {
        return EMPTY;
    }
    return Constants.encodeASCII("Subproject commit " + id.name() + "\n");
}
 
Example #6
Source File: AutoCRLFObjectReader.java    From git-code-format-maven-plugin with MIT License 4 votes vote down vote up
@Override
public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException {
  return delegate.resolve(id);
}