From aba6c3c2bfc0caa91dd94770cba317f4eea74cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pluchino?= Date: Sat, 7 Aug 2021 16:44:09 +0200 Subject: [PATCH] Do not checkout on the subtree branch before split --- src/Splitter/Adapter/SplitshLiteAdapter.php | 2 -- src/Splitter/Splitter.php | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Splitter/Adapter/SplitshLiteAdapter.php b/src/Splitter/Adapter/SplitshLiteAdapter.php index c034b83..3febb2c 100644 --- a/src/Splitter/Adapter/SplitshLiteAdapter.php +++ b/src/Splitter/Adapter/SplitshLiteAdapter.php @@ -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]); } } diff --git a/src/Splitter/Splitter.php b/src/Splitter/Splitter.php index c3ead15..746d183 100644 --- a/src/Splitter/Splitter.php +++ b/src/Splitter/Splitter.php @@ -90,16 +90,14 @@ public function prepare(string $remote, string $branch, bool $fetch = true): voi } $this->io->write(sprintf('[%s] Create subtree working branch %s', $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('[%s] Clean subtree working branch %s', $branch, $subTreeBranch), true, OutputInterface::VERBOSITY_VERBOSE); - ProcessUtil::run(['git', 'checkout', '-B', $branch, $remoteBranch], false); ProcessUtil::run(['git', 'branch', '-D', $subTreeBranch], false); }