private static void cleanupPeeledRef(DirCacheEditor ed, Ref ref) { if (ref != null && !ref.isSymbolic() && (!ref.isPeeled() || ref.getPeeledObjectId() != null)) { ed.add(new DeletePath(peeledPath(ref.getName()))); } }
ed.add(new DeletePath(path)); cleanupPeeledRef(ed, oldRef); return; ed.add(new PathEdit(path) { @Override public void apply(DirCacheEntry ent) { ed.add(new PathEdit(path) { @Override public void apply(DirCacheEntry ent) { ed.add(new PathEdit(peeledPath(newRef.getName())) { @Override public void apply(DirCacheEntry ent) {
void addToTemporaryInCoreIndex(final DirCacheEditor editor, final DirCacheEntry dcEntry, final ObjectId objectId, final FileMode fileMode) { editor.add(new DirCacheEditor.PathEdit(dcEntry) { @Override public void apply(final DirCacheEntry ent) { ent.setObjectId(objectId); ent.setFileMode(fileMode); } }); } }
final String filterCommand = treeWalk .getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE); editor.add(new PathEdit(path) { @Override public void apply(DirCacheEntry ent) {
public static void updateFile(CacheEntryUpdate update, DirCacheEditor editor) { editor.add(update); }
editor.add(new PathEdit(pathName(cmd.getRefName())) { @Override public void apply(DirCacheEntry ent) {
private void checkoutPathsFromCommit(TreeWalk treeWalk, DirCache dc, RevCommit commit) throws IOException { treeWalk.addTree(commit.getTree()); final ObjectReader r = treeWalk.getObjectReader(); DirCacheEditor editor = dc.editor(); while (treeWalk.next()) { final ObjectId blobId = treeWalk.getObjectId(0); final FileMode mode = treeWalk.getFileMode(0); final EolStreamType eolStreamType = treeWalk .getEolStreamType(CHECKOUT_OP); final String filterCommand = treeWalk .getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE); final String path = treeWalk.getPathString(); editor.add(new PathEdit(path) { @Override public void apply(DirCacheEntry ent) { ent.setObjectId(blobId); ent.setFileMode(mode); checkoutPath(ent, r, new CheckoutMetadata(eolStreamType, filterCommand)); actuallyModifiedPaths.add(path); } }); } editor.commit(); }
public static void deleteFile(@Nonnull String path, @Nonnull DirCacheEditor editor) { editor.add(deleteEntry(path)); }
public static void deleteDirectory(String path, DirCacheEditor editor) { editor.add(deleteChildren(path)); }
public static void deleteDirectory(String path, DirCacheEditor editor) { editor.add(deleteChildren(path)); }
public static void deleteFile(String path, DirCacheEditor editor) { editor.add(deleteEntry(path)); }
private static void applyPathEdit(DirCache dirCache, PathEdit edit) { final DirCacheEditor e = dirCache.editor(); e.add(edit); e.finish(); }
private static void applyPathEdit(DirCache dirCache, PathEdit edit) { final DirCacheEditor e = dirCache.editor(); e.add(edit); e.finish(); }
private static void applyPathEdit(DirCache dirCache, PathEdit edit) { final DirCacheEditor e = dirCache.editor(); e.add(edit); e.finish(); }
private void moveFromSubdirectoryToRoot(final DirCacheEditor editor, final String pathString, final CanonicalTreeParser treeParser) { final String newPath = pathString.substring(subdirectory.length()); final ObjectId entryObjectId = treeParser.getEntryObjectId(); final FileMode entryFileMode = treeParser.getEntryFileMode(); editor.add(new DirCacheEditor.PathEdit(new DirCacheEntry(newPath)) { @Override public void apply(DirCacheEntry ent) { ent.setObjectId(entryObjectId); ent.setFileMode(entryFileMode); } }); }
private void writeBlob(final DirCacheEditor editor, ObjectInserter inserter, TestFile data) throws IOException { final ObjectId blobId = inserter.insert(Constants.OBJ_BLOB, data.content.length(), IOUtils.toInputStream(data.content, "UTF-8")); editor.add(new PathEdit(data.path) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); ent.setObjectId(blobId); } }); } }
private void writeBlob(final DirCacheEditor editor, ObjectInserter inserter, TestFile data) throws IOException { final ObjectId blobId = inserter.insert(Constants.OBJ_BLOB, data.content.length(), IOUtils.toInputStream(data.content, "UTF-8")); editor.add(new PathEdit(data.path) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); ent.setObjectId(blobId); } }); } }
private static void cleanupPeeledRef(DirCacheEditor ed, Ref ref) { if (ref != null && !ref.isSymbolic() && (!ref.isPeeled() || ref.getPeeledObjectId() != null)) { ed.add(new DeletePath(peeledPath(ref.getName()))); } }
private static void cleanupPeeledRef(DirCacheEditor ed, Ref ref) { if (ref != null && !ref.isSymbolic() && (!ref.isPeeled() || ref.getPeeledObjectId() != null)) { ed.add(new DeletePath(peeledPath(ref.getName()))); } }