/** {@inheritDoc} */ @Override protected Result doRename() throws IOException { // TODO Correctly handle renaming foo/bar to foo. // TODO Batch these together into one log update. destination.setExpectedOldObjectId(ObjectId.zeroId()); destination.setNewObjectId(source.getRef().getObjectId()); switch (destination.update()) { case NEW: source.delete(); return Result.RENAMED; default: return destination.getResult(); } } }
throw new IOException("Cannot write " + ref + " " + u.getResult());
/** * Delete a reference. * * @param ref * the name of the reference to delete. This is normalized * in the same way as {@link #update(String, AnyObjectId)}. * @throws Exception * @since 4.4 */ public void delete(String ref) throws Exception { ref = normalizeRef(ref); RefUpdate u = db.updateRef(ref); switch (u.delete()) { case FAST_FORWARD: case FORCED: case NEW: case NO_CHANGE: updateServerInfo(); return; default: throw new IOException("Cannot delete " + ref + " " + u.getResult()); } }
throw new IOException("Cannot write " + ref + " " + u.getResult());
/** * Delete a reference. * * @param ref * the name of the reference to delete. This is normalized * in the same way as {@link #update(String, AnyObjectId)}. * @throws Exception * @since 4.4 */ public void delete(String ref) throws Exception { ref = normalizeRef(ref); RefUpdate u = db.updateRef(ref); u.setForceUpdate(true); switch (u.delete()) { case FAST_FORWARD: case FORCED: case NEW: case NO_CHANGE: updateServerInfo(); return; default: throw new IOException("Cannot delete " + ref + " " + u.getResult()); } }
throw new IOException("Cannot write " + ref + " " + u.getResult());
@Override protected Result doRename() throws IOException { // TODO(spearce) Correctly handle renameing foo/bar to foo. destination.setExpectedOldObjectId(ObjectId.zeroId()); destination.setNewObjectId(source.getRef().getObjectId()); switch (destination.update()) { case NEW: source.delete(); return Result.RENAMED; default: return destination.getResult(); } } }
@Override protected Result doRename() throws IOException { // TODO(spearce) Correctly handle renameing foo/bar to foo. destination.setExpectedOldObjectId(ObjectId.zeroId()); destination.setNewObjectId(source.getRef().getObjectId()); switch (destination.update()) { case NEW: source.delete(); return Result.RENAMED; default: return destination.getResult(); } } }
@Override protected Result doRename() throws IOException { // TODO Correctly handle renaming foo/bar to foo. // TODO Batch these together into one log update. destination.setExpectedOldObjectId(ObjectId.zeroId()); destination.setNewObjectId(source.getRef().getObjectId()); switch (destination.update()) { case NEW: source.delete(); return Result.RENAMED; default: return destination.getResult(); } } }
/** {@inheritDoc} */ @Override protected Result doRename() throws IOException { // TODO Correctly handle renaming foo/bar to foo. // TODO Batch these together into one log update. destination.setExpectedOldObjectId(ObjectId.zeroId()); destination.setNewObjectId(source.getRef().getObjectId()); switch (destination.update()) { case NEW: source.delete(); return Result.RENAMED; default: return destination.getResult(); } } }