ics: do not fetch twice
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Fri, 12 Aug 2016 14:11:22 +0000 (16:11 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Fri, 12 Aug 2016 14:12:11 +0000 (16:12 +0200)
plugins/settings-repository/src/git/GitRepositoryManager.kt
plugins/settings-repository/src/git/pull.kt

index e57b6ae04b4575abc5fbc05d1b34cc0269318b99..ed5530c8c5304eaa39fe92ec8141876a793f8e1f 100644 (file)
@@ -216,13 +216,11 @@ class GitRepositoryManager(private val credentialsStore: NotNullLazyValue<Creden
       // KT-8632
       override fun merge(): UpdateResult? = lock.write {
         val committed = commit(pullTask.indicator)
-        if (refToMerge == null && !committed && getAheadCommitsCount() == 0) {
-          definitelySkipPush = true
+        if (refToMerge == null) {
+          definitelySkipPush = !committed && getAheadCommitsCount() == 0
           return null
         }
-        else {
-          return pullTask.pull(prefetchedRefToMerge = refToMerge)
-        }
+        return pullTask.pull(prefetchedRefToMerge = refToMerge)
       }
     }
   }
index 6723a9a77daea06dfc3550e3afad1cb2dadf3f73..80b0e20599303d03057f6de268eb9b6569f46c5e 100644 (file)
@@ -62,7 +62,7 @@ open internal class Pull(val manager: GitRepositoryManager, val indicator: Progr
       return null
     }
 
-    var refToMerge = prefetchedRefToMerge ?: fetch() ?: return null
+    val refToMerge = prefetchedRefToMerge ?: fetch() ?: return null
     val mergeResult = merge(refToMerge, mergeStrategy, commitMessage = commitMessage)
     val mergeStatus = mergeResult.status
     LOG.debug { mergeStatus.toString() }