if (buildByBranchName.getValue().getSHA1().equals(ObjectId.fromString(scmRevisionHash))) { addGitLabBranchBuild(result, scmRevisionHash, buildData.getRemoteUrls(), environment, gitLabClient);
/** * Compares whether two pairs of ObjectId and FileMode are equal. * * @param id1 * @param mode1 * @param id2 * @param mode2 * @return <code>true</code> if FileModes and ObjectIds are equal. * <code>false</code> otherwise */ private boolean equalIdAndMode(ObjectId id1, FileMode mode1, ObjectId id2, FileMode mode2) { if (!mode1.equals(mode2)) return false; return id1 != null ? id1.equals(id2) : id2 == null; }
private void removeFetchHeadRecord(ObjectId want) { final Iterator<FetchHeadRecord> i = fetchHeadUpdates.iterator(); while (i.hasNext()) { final FetchHeadRecord fh = i.next(); if (fh.newValue.equals(want)) i.remove(); } }
private void removeTrackingRefUpdate(ObjectId want) { final Iterator<TrackingRefUpdate> i = localUpdates.iterator(); while (i.hasNext()) { final TrackingRefUpdate u = i.next(); if (u.getNewObjectId().equals(want)) i.remove(); } }
/** * Whether this update is a deleting update * * @return true if this update is deleting update; false otherwise. */ public boolean isDelete() { return ObjectId.zeroId().equals(newObjectId); }
private static boolean isMissing(RevWalk walk, ObjectId id) throws IOException { if (id.equals(ObjectId.zeroId())) { return false; // Explicit add or delete is not missing. } try { walk.parseAny(id); return false; } catch (MissingObjectException e) { return true; } }
private static boolean idEqual(AbstractTreeIterator a, AbstractTreeIterator b) { if (a == b) { return true; } if (a == null || b == null) { return false; } return a.getEntryObjectId().equals(b.getEntryObjectId()); }
private static RevObject safeParseNew(RevWalk rw, AnyObjectId newId) throws IOException { if (newId == null || ObjectId.zeroId().equals(newId)) { return null; } return rw.parseAny(newId); }
private static boolean equals(NoteBucket a, NoteBucket b) { if (a == null && b == null) return true; return a != null && b != null && a.getTreeId().equals(b.getTreeId()); }
private static boolean commandsEqual(PushCertificate c1, PushCertificate c2) { if (c1.commands.size() != c2.commands.size()) { return false; } for (int i = 0; i < c1.commands.size(); i++) { ReceiveCommand cmd1 = c1.commands.get(i); ReceiveCommand cmd2 = c2.commands.get(i); if (!cmd1.getOldId().equals(cmd2.getOldId()) || !cmd1.getNewId().equals(cmd2.getNewId()) || !cmd1.getRefName().equals(cmd2.getRefName())) { return false; } } return true; }
private boolean isModified_IndexTree(String path, ObjectId iId, FileMode iMode, ObjectId tId, FileMode tMode, ObjectId rootTree) throws CorruptObjectException, IOException { if (iMode != tMode) return true; if (FileMode.TREE.equals(iMode) && (iId == null || ObjectId.zeroId().equals(iId))) return isModifiedSubtree_IndexTree(path, rootTree); else return !equalIdAndMode(iId, iMode, tId, tMode); }
private boolean hasDanglingHead() throws IOException { Ref head = exactRef(Constants.HEAD); if (head != null) { ObjectId id = head.getObjectId(); return id == null || id.equals(ObjectId.zeroId()); } return false; }
PackedRefList getPackedRefs() throws IOException { boolean trustFolderStat = getRepository().getConfig().getBoolean( ConfigConstants.CONFIG_CORE_SECTION, ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); final PackedRefList curList = packedRefs.get(); if (trustFolderStat && !curList.snapshot.isModified(packedRefsFile)) { return curList; } final PackedRefList newList = readPackedRefs(); if (packedRefs.compareAndSet(curList, newList) && !curList.id.equals(newList.id)) { modCnt.incrementAndGet(); } return newList; }
private static byte[] writeGitLinkText(AbbreviatedObjectId id) { if (ObjectId.zeroId().equals(id.toObjectId())) { return EMPTY; } return encodeASCII("Subproject commit " + id.name() //$NON-NLS-1$ + "\n"); //$NON-NLS-1$ }
private void addUpdateBatchCommands(FetchResult result, BatchRefUpdate batch) throws TransportException { Map<String, ObjectId> refs = new HashMap<>(); for (TrackingRefUpdate u : localUpdates) { // Try to skip duplicates if they'd update to the same object ID ObjectId existing = refs.get(u.getLocalName()); if (existing == null) { refs.put(u.getLocalName(), u.getNewObjectId()); result.add(u); batch.addCommand(u.asReceiveCommand()); } else if (!existing.equals(u.getNewObjectId())) { throw new TransportException(MessageFormat .format(JGitText.get().duplicateRef, u.getLocalName())); } } }
/** * Check if the current entry of both iterators has the same id. * <p> * This method is faster than {@link #getEntryObjectId()} as it does not * require copying the bytes out of the buffers. A direct {@link #idBuffer} * compare operation is performed. * * @param otherIterator * the other iterator to test against. * @return true if both iterators have the same object id; false otherwise. */ public boolean idEqual(AbstractTreeIterator otherIterator) { return ObjectId.equals(idBuffer(), idOffset(), otherIterator.idBuffer(), otherIterator.idOffset()); }
private RawText getRawText(ObjectId id, Attributes attributes) throws IOException, BinaryBlobException { if (id.equals(ObjectId.zeroId())) return new RawText(new byte[] {}); ObjectLoader loader = LfsFactory.getInstance().applySmudgeFilter( getRepository(), reader.open(id, OBJ_BLOB), attributes.get(Constants.ATTR_MERGE)); int threshold = PackConfig.DEFAULT_BIG_FILE_THRESHOLD; return RawText.load(loader, threshold); }
private static boolean matchOld(ReceiveCommand cmd, @Nullable Ref ref) { if (ref == null) { return AnyObjectId.equals(ObjectId.zeroId(), cmd.getOldId()) && cmd.getOldSymref() == null; } else if (ref.isSymbolic()) { return ref.getTarget().getName().equals(cmd.getOldSymref()); } ObjectId id = ref.getObjectId(); if (id == null) { id = ObjectId.zeroId(); } return cmd.getOldId().equals(id); }
private void initialize() throws IOException { try (Repository git = openRepository(); RevWalk rw = new RevWalk(git)) { self.initialize(git); ObjectId accepted = self.getTxnAccepted(); if (!ObjectId.zeroId().equals(accepted)) { RevCommit c = rw.parseCommit(accepted); headIndex = LogIndex.unknown(accepted); refTree = RefTree.read(rw.getObjectReader(), c.getTree()); } else { headIndex = LogIndex.unknown(ObjectId.zeroId()); refTree = RefTree.newEmptyTree(); } } }