Skip to content

Commit

Permalink
Do not checkout on the subtree branch before split
Browse files Browse the repository at this point in the history
  • Loading branch information
francoispluchino committed Aug 7, 2021
1 parent 11d693c commit aba6c3c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 0 additions & 2 deletions src/Splitter/Adapter/SplitshLiteAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ private function subtree(string $libraryPath, string $libraryBranch, bool $scrat
{
$opt = $scratch ? ['--scratch'] : [];
ProcessUtil::run(['splitsh-lite', '--prefix='.$libraryPath, '--target=heads/'.$libraryBranch, '--quiet', ...$opt]);
ProcessUtil::run(['git', 'checkout', 'heads/'.$libraryBranch]);
ProcessUtil::run(['git', 'switch', '-c', $libraryBranch]);
}
}
4 changes: 1 addition & 3 deletions src/Splitter/Splitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,14 @@ public function prepare(string $remote, string $branch, bool $fetch = true): voi
}

$this->io->write(sprintf('[<info>%s</info>] Create subtree working branch <comment>%s</comment>', $branch, $subTreeBranch), true, OutputInterface::VERBOSITY_VERBOSE);
ProcessUtil::run(['git', 'checkout', '-B', $subTreeBranch, $remoteBranch]);
ProcessUtil::run(['git', 'branch', $subTreeBranch, $remoteBranch]);
}

public function terminate(string $remote, string $branch): void
{
$remoteBranch = $remote.'/'.$branch;
$subTreeBranch = BranchUtil::getSubTreeBranchName($branch);

$this->io->write(sprintf('[<info>%s</info>] Clean subtree working branch <comment>%s</comment>', $branch, $subTreeBranch), true, OutputInterface::VERBOSITY_VERBOSE);
ProcessUtil::run(['git', 'checkout', '-B', $branch, $remoteBranch], false);
ProcessUtil::run(['git', 'branch', '-D', $subTreeBranch], false);
}

Expand Down

0 comments on commit aba6c3c

Please sign in to comment.