private boolean renameLog(RefUpdate src, RefUpdate dst) { File srcLog = refdb.getLogWriter().logFor(src.getName()); File dstLog = refdb.getLogWriter().logFor(dst.getName()); if (!srcLog.exists()) return true; if (!rename(srcLog, dstLog)) return false; try { final int levels = RefDirectory.levelsIn(src.getName()) - 2; RefDirectory.delete(srcLog, levels); return true; } catch (IOException e) { rename(dstLog, srcLog); return false; } }
private boolean linkHEAD(RefUpdate target) { try { RefUpdate u = refdb.newUpdate(Constants.HEAD, false); u.disableRefLog(); switch (u.link(target.getName())) { case NEW: case FORCED: case NO_CHANGE: return true; default: return false; } } catch (IOException e) { return false; } }