/** * Obtain the {@link org.eclipse.jgit.lib.FileMode} for this entry. * * @return the file mode singleton for this entry. */ public FileMode getFileMode() { return FileMode.fromBits(getRawMode()); }
/** * Check the entry is consistent with either the old or the new ref. * * @param entry * current entry; null if the entry does not exist. * @return true if entry matches {@link #getOldRef()} or * {@link #getNewRef()}; otherwise false. */ boolean checkRef(@Nullable DirCacheEntry entry) { if (entry != null && entry.getRawMode() == 0) { entry = null; } return check(entry, oldRef) || check(entry, newRef); }
/** * Append one entry into the resulting entry list. * <p> * The entry is placed at the end of the entry list. If the entry causes the * list to now be incorrectly sorted a final sorting phase will be * automatically enabled within {@link #finish()}. * <p> * The internal entry table is automatically expanded if there is * insufficient space for the new addition. * * @param newEntry * the new entry to add. * @throws java.lang.IllegalArgumentException * If the FileMode of the entry was not set by the caller. */ public void add(DirCacheEntry newEntry) { if (newEntry.getRawMode() == 0) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().fileModeNotSetForPath, newEntry.getPathString())); beforeAdd(newEntry); fastAdd(newEntry); }
private static boolean check(@Nullable DirCacheEntry cur, @Nullable Ref exp) { if (cur == null) { // Does not exist, ok if oldRef does not exist. return exp == null; } else if (exp == null) { // Expected to not exist, but currently exists, fail. return false; } if (exp.isSymbolic()) { String dst = exp.getTarget().getName(); return cur.getRawMode() == TYPE_SYMLINK && cur.getObjectId().equals(symref(dst)); } return cur.getRawMode() == TYPE_GITLINK && cur.getObjectId().equals(exp.getObjectId()); }
private Ref toRef(ObjectReader reader, DirCacheEntry e, String name) throws IOException { int mode = e.getRawMode(); if (mode == TYPE_GITLINK) { ObjectId id = e.getObjectId(); return new ObjectIdRef.PeeledNonTag(PACKED, name, id); } if (mode == TYPE_SYMLINK) { ObjectId id = e.getObjectId(); String n = pendingBlobs != null ? pendingBlobs.get(id) : null; if (n == null) { byte[] bin = reader.open(id, OBJ_BLOB).getCachedBytes(); n = RawParseUtils.decode(bin); } Ref dst = new ObjectIdRef.Unpeeled(NEW, n, null); return new SymbolicRef(name, dst); } return null; // garbage file or something; not a reference. }
DirCacheEntry ent = new DirCacheEntry(e.path); e.apply(ent); if (ent.getRawMode() == 0) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().fileModeNotSetForPath,
CheckoutMetadata meta = e.getValue(); DirCacheEntry entry = dc.getEntry(path); if (FileMode.GITLINK.equals(entry.getRawMode())) { checkoutGitlink(path, entry); } else {
if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true);
int m = s < nPath.length ? TYPE_TREE : n.getRawMode(); int cmp = compareSameName( ePath, prefixLen, ePath.length,
if (p != null && p.getRawMode() == TYPE_GITLINK) { return new ObjectIdRef.PeeledTag(PACKED, r.getName(), r.getObjectId(), p.getObjectId());
return MetadataDiff.DIFFER_BY_METADATA; if (isModeDifferent(entry.getRawMode())) return MetadataDiff.DIFFER_BY_METADATA;
/** * Obtain the {@link FileMode} for this entry. * * @return the file mode singleton for this entry. */ public FileMode getFileMode() { return FileMode.fromBits(getRawMode()); }
/** * Obtain the {@link org.eclipse.jgit.lib.FileMode} for this entry. * * @return the file mode singleton for this entry. */ public FileMode getFileMode() { return FileMode.fromBits(getRawMode()); }
mode = currentEntry.getRawMode(); path = cep; pathLen = cep.length;
/** * Check the entry is consistent with either the old or the new ref. * * @param entry * current entry; null if the entry does not exist. * @return true if entry matches {@link #getOldRef()} or * {@link #getNewRef()}; otherwise false. */ boolean checkRef(@Nullable DirCacheEntry entry) { if (entry != null && entry.getRawMode() == 0) { entry = null; } return check(entry, oldRef) || check(entry, newRef); }
/** * Check the entry is consistent with either the old or the new ref. * * @param entry * current entry; null if the entry does not exist. * @return true if entry matches {@link #getOldRef()} or * {@link #getNewRef()}; otherwise false. */ boolean checkRef(@Nullable DirCacheEntry entry) { if (entry != null && entry.getRawMode() == 0) { entry = null; } return check(entry, oldRef) || check(entry, newRef); }
private static boolean check(@Nullable DirCacheEntry cur, @Nullable Ref exp) { if (cur == null) { // Does not exist, ok if oldRef does not exist. return exp == null; } else if (exp == null) { // Expected to not exist, but currently exists, fail. return false; } if (exp.isSymbolic()) { String dst = exp.getTarget().getName(); return cur.getRawMode() == TYPE_SYMLINK && cur.getObjectId().equals(symref(dst)); } return cur.getRawMode() == TYPE_GITLINK && cur.getObjectId().equals(exp.getObjectId()); }
private static boolean check(@Nullable DirCacheEntry cur, @Nullable Ref exp) { if (cur == null) { // Does not exist, ok if oldRef does not exist. return exp == null; } else if (exp == null) { // Expected to not exist, but currently exists, fail. return false; } if (exp.isSymbolic()) { String dst = exp.getTarget().getName(); return cur.getRawMode() == TYPE_SYMLINK && cur.getObjectId().equals(symref(dst)); } return cur.getRawMode() == TYPE_GITLINK && cur.getObjectId().equals(exp.getObjectId()); }
private Ref toRef(ObjectReader reader, DirCacheEntry e, String name) throws IOException { int mode = e.getRawMode(); if (mode == TYPE_GITLINK) { ObjectId id = e.getObjectId(); return new ObjectIdRef.PeeledNonTag(PACKED, name, id); } if (mode == TYPE_SYMLINK) { ObjectId id = e.getObjectId(); String n = pendingBlobs != null ? pendingBlobs.get(id) : null; if (n == null) { byte[] bin = reader.open(id, OBJ_BLOB).getCachedBytes(); n = RawParseUtils.decode(bin); } Ref dst = new ObjectIdRef.Unpeeled(NEW, n, null); return new SymbolicRef(name, dst); } return null; // garbage file or something; not a reference. }
private Ref toRef(ObjectReader reader, DirCacheEntry e, String name) throws IOException { int mode = e.getRawMode(); if (mode == TYPE_GITLINK) { ObjectId id = e.getObjectId(); return new ObjectIdRef.PeeledNonTag(PACKED, name, id); } if (mode == TYPE_SYMLINK) { ObjectId id = e.getObjectId(); String n = pendingBlobs != null ? pendingBlobs.get(id) : null; if (n == null) { byte[] bin = reader.open(id, OBJ_BLOB).getCachedBytes(); n = RawParseUtils.decode(bin); } Ref dst = new ObjectIdRef.Unpeeled(NEW, n, null); return new SymbolicRef(name, dst); } return null; // garbage file or something; not a reference. }