private void update(String path, ObjectId mId, FileMode mode) throws IOException { if (!FileMode.TREE.equals(mode)) { updated.put(path, new CheckoutMetadata( walk.getEolStreamType(CHECKOUT_OP), walk.getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE))); DirCacheEntry entry = new DirCacheEntry(path, DirCacheEntry.STAGE_0); entry.setObjectId(mId); entry.setFileMode(mode); builder.add(entry); } }
private static DirCacheEntry toEntry(int stage, CanonicalTreeParser i) { byte[] buf = i.getEntryPathBuffer(); int len = i.getEntryPathLength(); byte[] path = new byte[len]; System.arraycopy(buf, 0, path, 0, len); DirCacheEntry e = new DirCacheEntry(path, stage); e.setFileMode(i.getEntryRawMode()); e.setObjectIdFromRaw(i.idBuffer(), i.idOffset()); return e; }
/** * Create a deep copy of this RefTree. * * @return a deep copy of this RefTree. */ public RefTree copy() { RefTree r = new RefTree(DirCache.newInCore()); DirCacheBuilder b = r.contents.builder(); for (int i = 0; i < contents.getEntryCount(); i++) { b.add(new DirCacheEntry(contents.getEntry(i))); } b.finish(); if (pendingBlobs != null) { r.pendingBlobs = new HashMap<>(pendingBlobs); } return r; }
/** * A conflict is detected - add the three different stages to the index * @param path the path of the conflicting entry * @param e the previous index entry * @param h the first tree you want to merge (the HEAD) * @param m the second tree you want to merge */ private void conflict(String path, DirCacheEntry e, AbstractTreeIterator h, AbstractTreeIterator m) { conflicts.add(path); DirCacheEntry entry; if (e != null) { entry = new DirCacheEntry(e.getPathString(), DirCacheEntry.STAGE_1); entry.copyMetaData(e, true); builder.add(entry); } if (h != null && !FileMode.TREE.equals(h.getEntryFileMode())) { entry = new DirCacheEntry(h.getEntryPathString(), DirCacheEntry.STAGE_2); entry.setFileMode(h.getEntryFileMode()); entry.setObjectId(h.getEntryObjectId()); builder.add(entry); } if (m != null && !FileMode.TREE.equals(m.getEntryFileMode())) { entry = new DirCacheEntry(m.getEntryPathString(), DirCacheEntry.STAGE_3); entry.setFileMode(m.getEntryFileMode()); entry.setObjectId(m.getEntryObjectId()); builder.add(entry); } }
/** * adds a new path with the specified stage to the index builder * * @param path * @param p * @param stage * @param lastMod * @param len * @return the entry which was added to the index */ private DirCacheEntry add(byte[] path, CanonicalTreeParser p, int stage, long lastMod, long len) { if (p != null && !p.getEntryFileMode().equals(FileMode.TREE)) { DirCacheEntry e = new DirCacheEntry(path, stage); e.setFileMode(p.getEntryFileMode()); e.setObjectId(p.getEntryObjectId()); e.setLastModified(lastMod); e.setLength(len); builder.add(e); return e; } return null; }
DirCacheEntry ent = new DirCacheEntry(e.path); e.apply(ent); if (ent.getRawMode() == 0) {
sortedEntries[i] = new DirCacheEntry(infos, infoAt, in, md, smudge_s, smudge_ns);
/** * adds a entry to the index builder which is a copy of the specified * DirCacheEntry * * @param e * the entry which should be copied * * @return the entry which was added to the index */ private DirCacheEntry keep(DirCacheEntry e) { DirCacheEntry newEntry = new DirCacheEntry(e.getRawPath(), e.getStage()); newEntry.setFileMode(e.getFileMode()); newEntry.setObjectId(e.getObjectId()); newEntry.setLastModified(e.getLastModified()); newEntry.setLength(e.getLength()); builder.add(newEntry); return newEntry; }
private void add(int tree, int stage) throws IOException { final AbstractTreeIterator i = getTree(tree); if (i != null) { if (FileMode.TREE.equals(tw.getRawMode(tree))) { builder.addTree(tw.getRawPath(), stage, reader, tw .getObjectId(tree)); } else { final DirCacheEntry e; e = new DirCacheEntry(tw.getRawPath(), stage); e.setObjectIdFromRaw(i.idBuffer(), i.idOffset()); e.setFileMode(tw.getFileMode(tree)); builder.add(e); } } }
final DirCacheEntry entry = new DirCacheEntry(walk.getRawPath()); entry.setFileMode(cIter.getEntryFileMode()); entry.setObjectIdFromRaw(cIter.idBuffer(), cIter.idOffset());
DirCacheEntry dcEntry = new DirCacheEntry(path); dcEntry.setObjectId(objectId); dcEntry.setFileMode(FileMode.GITLINK); objectId = inserter.insert(Constants.OBJ_BLOB, rf.getContents()); dcEntry = new DirCacheEntry(copyfile.dest); dcEntry.setObjectId(objectId); dcEntry.setFileMode(rf.getFileMode()); dcEntry = new DirCacheEntry(linkfile.dest); dcEntry.setObjectId(objectId); dcEntry.setFileMode(FileMode.SYMLINK); final DirCacheEntry dcEntry = new DirCacheEntry(Constants.DOT_GIT_MODULES); ObjectId objectId = inserter.insert(Constants.OBJ_BLOB, content.getBytes(UTF_8)); final DirCacheEntry dcEntryAttr = new DirCacheEntry(Constants.DOT_GIT_ATTRIBUTES); ObjectId attrId = inserter.insert(Constants.OBJ_BLOB, attributes.toString().getBytes(UTF_8));
DirCacheEntry entry = new DirCacheEntry(tw.getRawPath()); entry.setFileMode(tree.getEntryFileMode()); entry.setObjectId(tree.getEntryObjectId());
DirCacheEntry dce = new DirCacheEntry(tw.getPathString());
final DirCacheEntry dcEntry = new DirCacheEntry(path); long entryLength = fTree.getEntryLength(); dcEntry.setLength(entryLength); final DirCacheEntry dcEntry = new DirCacheEntry(path); dcEntry.setObjectId(hTree.getEntryObjectId()); dcEntry.setFileMode(hTree.getEntryFileMode());
continue; treeWalk.getObjectId(id, 0); final DirCacheEntry entry = new DirCacheEntry( treeWalk.getRawPath()); entry.setLength(wtIter.getEntryLength());
final DirCacheEntry entry = new DirCacheEntry(walk.getRawPath()); entry.setFileMode(cIter.getEntryFileMode()); entry.setObjectIdFromRaw(cIter.idBuffer(), cIter.idOffset());
ourDce = new DirCacheEntry(tw.getRawPath()); ourDce.setObjectId(tw.getObjectId(T_OURS)); ourDce.setFileMode(tw.getFileMode(T_OURS));
final DirCacheEntry entry = new DirCacheEntry(walk.getRawPath()); entry.setFileMode(cIter.getEntryFileMode()); entry.setObjectIdFromRaw(cIter.idBuffer(), cIter.idOffset());
private void update(String path, ObjectId mId, FileMode mode) throws IOException { if (!FileMode.TREE.equals(mode)) { updated.put(path, new CheckoutMetadata(walk.getEolStreamType(), walk.getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE))); DirCacheEntry entry = new DirCacheEntry(path, DirCacheEntry.STAGE_0); entry.setObjectId(mId); entry.setFileMode(mode); builder.add(entry); } }
entry = new DirCacheEntry(path);