/** * Tests if this ObjectId starts with the given abbreviation. * * @param abbr * the abbreviation. * @return true if this ObjectId begins with the abbreviation; else false. */ public boolean startsWith(AbbreviatedObjectId abbr) { return abbr.prefixCompare(this) == 0; }
@Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { Collection<ObjectId> stored = ctx.resolve(id); if (objectList == null) return stored; Set<ObjectId> r = new HashSet<>(stored.size() + 2); r.addAll(stored); for (PackedObjectInfo obj : objectList) { if (id.prefixCompare(obj) == 0) r.add(obj.copy()); } return r; }
@Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { Collection<ObjectId> stored = ctx.resolve(id); if (objectList == null) { return stored; } Set<ObjectId> r = new HashSet<>(stored.size() + 2); r.addAll(stored); for (PackedObjectInfo obj : objectList) { if (id.prefixCompare(obj) == 0) { r.add(obj.copy()); } } return r; }
do { int p = (low + high) >>> 1; final int cmp = id.prefixCompare(data, idOffset(p)); if (cmp < 0) high = p; while (0 < p && id.prefixCompare(data, idOffset(p - 1)) == 0) p--; for (; p < max && id.prefixCompare(data, idOffset(p)) == 0; p++) { matches.add(ObjectId.fromRaw(data, idOffset(p))); if (matches.size() > matchLimit)
do { int p = (low + high) >>> 1; final int cmp = id.prefixCompare(data, idOffset(p)); if (cmp < 0) high = p; while (0 < p && id.prefixCompare(data, idOffset(p - 1)) == 0) p--; for (; p < max && id.prefixCompare(data, idOffset(p)) == 0; p++) { matches.add(ObjectId.fromRaw(data, idOffset(p))); if (matches.size() > matchLimit)
List<ObjectId> n = new ArrayList<>(8); for (ObjectId candidate : matches) { if (abbrev.prefixCompare(candidate) == 0) n.add(candidate);
try { ObjectId entId = ObjectId.fromString(fanOut + e); if (id.prefixCompare(entId) == 0) matches.add(entId); } catch (IllegalArgumentException notId) {
/** * Tests if this ObjectId starts with the given abbreviation. * * @param abbr * the abbreviation. * @return true if this ObjectId begins with the abbreviation; else false. */ public boolean startsWith(final AbbreviatedObjectId abbr) { return abbr.prefixCompare(this) == 0; }
/** * Tests if this ObjectId starts with the given abbreviation. * * @param abbr * the abbreviation. * @return true if this ObjectId begins with the abbreviation; else false. */ public boolean startsWith(AbbreviatedObjectId abbr) { return abbr.prefixCompare(this) == 0; }
@Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { Collection<ObjectId> stored = ctx.resolve(id); if (objectList == null) return stored; Set<ObjectId> r = new HashSet<ObjectId>(stored.size() + 2); r.addAll(stored); for (PackedObjectInfo obj : objectList) { if (id.prefixCompare(obj) == 0) r.add(obj.copy()); } return r; }
@Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { Collection<ObjectId> stored = ctx.resolve(id); if (objectList == null) return stored; Set<ObjectId> r = new HashSet<>(stored.size() + 2); r.addAll(stored); for (PackedObjectInfo obj : objectList) { if (id.prefixCompare(obj) == 0) r.add(obj.copy()); } return r; }
@Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { Collection<ObjectId> stored = ctx.resolve(id); if (objectList == null) { return stored; } Set<ObjectId> r = new HashSet<>(stored.size() + 2); r.addAll(stored); for (PackedObjectInfo obj : objectList) { if (id.prefixCompare(obj) == 0) { r.add(obj.copy()); } } return r; }
private boolean processOne(Candidate n) throws IOException { RevCommit parent = n.getParent(0); if (parent == null) return split(n.getNextCandidate(0), n); revPool.parseHeaders(parent); if (find(parent, n.sourcePath)) { if (idBuf.equals(n.sourceBlob)) return blameEntireRegionOnParent(n, parent); return splitBlameWithParent(n, parent); } if (n.sourceCommit == null) return result(n); DiffEntry r = findRename(parent, n.sourceCommit, n.sourcePath); if (r == null) return result(n); if (0 == r.getOldId().prefixCompare(n.sourceBlob)) { // A 100% rename without any content change can also // skip directly to the parent. n.sourceCommit = parent; n.sourcePath = PathFilter.create(r.getOldPath()); push(n); return false; } Candidate next = n.create(getRepository(), parent, PathFilter.create(r.getOldPath())); next.sourceBlob = r.getOldId().toObjectId(); next.renameScore = r.getScore(); next.loadText(reader); return split(next, n); }
@Override public void resolve(Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit) throws IOException { byte[] data = idxdata[id.getFirstByte()]; if (data == null) return; int max = data.length / (4 + Constants.OBJECT_ID_LENGTH); int high = max; int low = 0; do { int p = (low + high) >>> 1; final int cmp = id.prefixCompare(data, idOffset(p)); if (cmp < 0) high = p; else if (cmp == 0) { // We may have landed in the middle of the matches. Move // backwards to the start of matches, then walk forwards. // while (0 < p && id.prefixCompare(data, idOffset(p - 1)) == 0) p--; for (; p < max && id.prefixCompare(data, idOffset(p)) == 0; p++) { matches.add(ObjectId.fromRaw(data, idOffset(p))); if (matches.size() > matchLimit) break; } return; } else low = p + 1; } while (low < high); }
do { int p = (low + high) >>> 1; final int cmp = id.prefixCompare(data, idOffset(p)); if (cmp < 0) high = p; while (0 < p && id.prefixCompare(data, idOffset(p - 1)) == 0) p--; for (; p < max && id.prefixCompare(data, idOffset(p)) == 0; p++) { matches.add(ObjectId.fromRaw(data, idOffset(p))); if (matches.size() > matchLimit)
@Override public void resolve(Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit) throws IOException { int[] data = names[id.getFirstByte()]; int max = offset32[id.getFirstByte()].length >>> 2; int high = max; if (high == 0) return; int low = 0; do { int p = (low + high) >>> 1; final int cmp = id.prefixCompare(data, idOffset(p)); if (cmp < 0) high = p; else if (cmp == 0) { // We may have landed in the middle of the matches. Move // backwards to the start of matches, then walk forwards. // while (0 < p && id.prefixCompare(data, idOffset(p - 1)) == 0) p--; for (; p < max && id.prefixCompare(data, idOffset(p)) == 0; p++) { matches.add(ObjectId.fromRaw(data, idOffset(p))); if (matches.size() > matchLimit) break; } return; } else low = p + 1; } while (low < high); }
do { int p = (low + high) >>> 1; final int cmp = id.prefixCompare(data, idOffset(p)); if (cmp < 0) high = p; while (0 < p && id.prefixCompare(data, idOffset(p - 1)) == 0) p--; for (; p < max && id.prefixCompare(data, idOffset(p)) == 0; p++) { matches.add(ObjectId.fromRaw(data, idOffset(p))); if (matches.size() > matchLimit)
ids = new ObjectId[pCnt]; ids[pCnt] = r.getOldId().toObjectId(); } else if (0 == r.getOldId().prefixCompare(n.sourceBlob)) {
private boolean processOne(Candidate n) throws IOException { RevCommit parent = n.getParent(0); if (parent == null) return split(n.getNextCandidate(0), n); revPool.parseHeaders(parent); if (find(parent, n.sourcePath)) { if (idBuf.equals(n.sourceBlob)) return blameEntireRegionOnParent(n, parent); return splitBlameWithParent(n, parent); } if (n.sourceCommit == null) return result(n); DiffEntry r = findRename(parent, n.sourceCommit, n.sourcePath); if (r == null) return result(n); if (0 == r.getOldId().prefixCompare(n.sourceBlob)) { // A 100% rename without any content change can also // skip directly to the parent. n.sourceCommit = parent; n.sourcePath = PathFilter.create(r.getOldPath()); push(n); return false; } Candidate next = n.create(parent, PathFilter.create(r.getOldPath())); next.sourceBlob = r.getOldId().toObjectId(); next.renameScore = r.getScore(); next.loadText(reader); return split(next, n); }
private boolean processOne(Candidate n) throws IOException { RevCommit parent = n.getParent(0); if (parent == null) return split(n.getNextCandidate(0), n); revPool.parseHeaders(parent); if (find(parent, n.sourcePath)) { if (idBuf.equals(n.sourceBlob)) return blameEntireRegionOnParent(n, parent); return splitBlameWithParent(n, parent); } if (n.sourceCommit == null) return result(n); DiffEntry r = findRename(parent, n.sourceCommit, n.sourcePath); if (r == null) return result(n); if (0 == r.getOldId().prefixCompare(n.sourceBlob)) { // A 100% rename without any content change can also // skip directly to the parent. n.sourceCommit = parent; n.sourcePath = PathFilter.create(r.getOldPath()); push(n); return false; } Candidate next = n.create(getRepository(), parent, PathFilter.create(r.getOldPath())); next.sourceBlob = r.getOldId().toObjectId(); next.renameScore = r.getScore(); next.loadText(reader); return split(next, n); }