Esempio n. 1
0
 public synchronized boolean setCurrentOperation(GitOperation op, boolean interruptExistingOp) {
   if (currentOperation == null || currentOperation.isDone()) {
     Log.d(TAG, "Prior op for  " + gitdir + " : " + currentOperation + " - new op=" + op);
     currentOperation = op;
     return true;
   }
   if (interruptExistingOp) {
     Log.d(TAG, "Interrupting existing op for " + gitdir + " : " + currentOperation + " -> " + op);
     currentOperation.cancel();
     currentOperation = op;
     return true;
   }
   Log.d(TAG, "Won't interrupt existing op for " + gitdir + " : " + currentOperation);
   return false;
 }
 <T> T execute(GitOperation<T> gitOperation) {
   Git git = openRepository();
   try {
     return guarded(() -> gitOperation.execute(git));
   } finally {
     git.close();
   }
 }