TW-48675 remove packed refs lock
authorDmitry Neverov <dmitry.neverov@gmail.com>
Sat, 27 Jan 2018 21:52:56 +0000 (22:52 +0100)
committerDmitry Neverov <dmitry.neverov@gmail.com>
Sat, 27 Jan 2018 21:52:56 +0000 (22:52 +0100)
Checkout can fail due to previous build cancelation:
https://youtrack.jetbrains.com/issue/TW-48675#comment=27-2684722

git-agent/src/jetbrains/buildServer/buildTriggers/vcs/git/agent/UpdaterImpl.java

index 202328194846a11cd9e6569ce40af598c94d4bb3..81b6cdd681e8405f9a3d9f407cd8645c07c184a1 100644 (file)
@@ -738,6 +738,11 @@ public class UpdaterImpl implements Updater {
       LOG.info("Remove a lock file " + lock.getAbsolutePath());
       FileUtil.delete(lock);
     }
+    File packedRefsLock = new File(dotGit, "packed-refs.lock");
+    if (packedRefsLock.isFile()) {
+      LOG.info("Remove a lock file " + packedRefsLock.getAbsolutePath());
+      FileUtil.delete(packedRefsLock);
+    }
   }
 
   private boolean isSilentFetch() {