givi - Fix handling of Drupal branches (filtered branch names) when running "resume"
authorTim Otten <totten@civicrm.org>
Tue, 12 Mar 2013 12:06:45 +0000 (08:06 -0400)
committerTim Otten <totten@civicrm.org>
Tue, 12 Mar 2013 12:06:45 +0000 (08:06 -0400)
bin/givi

index 6d4b9f5773bdc2fb98d6c1c134b4a4f80ec9395e..643ad9d9f3f22e627e1fc44281cdb18e160dc9ef 100755 (executable)
--- a/bin/givi
+++ b/bin/givi
@@ -264,6 +264,7 @@ class Givi {
     foreach ($this->repos as $repo => $relPath) {
       $filteredBranch = $this->filterBranchName($repo, $branches[$repo]);
       $filteredBaseBranch = $this->filterBranchName($repo, $baseBranch);
+
       if ($filteredBranch == $filteredBaseBranch) {
         $this->run($relPath, 'git', 'checkout', $filteredBranch);
       }
@@ -286,10 +287,12 @@ class Givi {
     }
 
     foreach ($this->repos as $repo => $relPath) {
-      $this->run($relPath, 'git', 'checkout', $branches[$repo]);
-      if ($branches[$repo] != $baseBranch && $this->rebase) {
-        // FIXME: assumes
-        list ($baseRemoteRepo, $baseRemoteBranch) = $this->parseBranchRepo($baseBranch);
+      $filteredBranch = $this->filterBranchName($repo, $branches[$repo]);
+      $filteredBaseBranch = $this->filterBranchName($repo, $baseBranch);
+
+      $this->run($relPath, 'git', 'checkout', $filteredBranch);
+      if ($filteredBranch != $filteredBaseBranch && $this->rebase) {
+        list ($baseRemoteRepo, $baseRemoteBranch) = $this->parseBranchRepo($filteredBaseBranch);
         $this->run($relPath, 'git', 'pull', '--rebase', $baseRemoteRepo, $baseRemoteBranch);
       }
     }