Skip to content

Commit

Permalink
Add git pull --rebase {base-branch} call at `GitHelper::squashCommi…
Browse files Browse the repository at this point in the history
…ts()`
  • Loading branch information
phansys committed Aug 27, 2016
1 parent 28b5ae9 commit 9f71f7e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Helper/GitHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,16 @@ public function squashCommits($base, $branchName, $ignoreMultipleAuthors = false
'-author' => $author,
]
);

try {
// Ensure squashed commits don't introduce regressions at base branch
$this->processHelper->runCommand(['git', 'pull', '--rebase', $base]);
} catch (\Exception $e) {
// Error, abort the rebase process
$this->processHelper->runCommand(['git', 'rebase', '--abort'], true);

throw new \RuntimeException(sprintf('Git rebase failed while trying to synchronize history against "%s".', $base), 0, $e);
}
}

public function syncWithRemote($remote, $branchName = null)
Expand Down

0 comments on commit 9f71f7e

Please sign in to comment.