Ejemplo n.º 1
0
  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;
    }
  }
Ejemplo n.º 2
0
 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;
   }
 }