diff --git a/app/src/App.php b/app/src/App.php index 250f48f8..93defe35 100644 --- a/app/src/App.php +++ b/app/src/App.php @@ -9,7 +9,7 @@ class App extends Application { - const NAME = "Doil Version 20230223 - build 2023-02-23"; + const NAME = "Doil Version 20230308 - build 2023-03-08"; public function __construct(Command ...$commands) { diff --git a/app/src/Commands/Instances/CreateCommand.php b/app/src/Commands/Instances/CreateCommand.php index 9147a3fb..39a0b618 100644 --- a/app/src/Commands/Instances/CreateCommand.php +++ b/app/src/Commands/Instances/CreateCommand.php @@ -625,7 +625,12 @@ protected function checkTarget() : Closure protected function getBranches(OutputInterface $output, string $path, string $url) : array { $this->writer->beginBlock($output, "Update repo $url"); - $this->git->fetchBare($path, $url); + $this->git->setLocalConfig( + $path, + "remote.origin.fetch", + "refs/heads/*:refs/heads/*" + ); + $this->git->fetchBare($path); $branches = $this->git->getBranches($path); $this->writer->endBlock(); return $branches; diff --git a/app/src/Commands/Repo/RepoManager.php b/app/src/Commands/Repo/RepoManager.php index adff11a2..6d04f30a 100644 --- a/app/src/Commands/Repo/RepoManager.php +++ b/app/src/Commands/Repo/RepoManager.php @@ -107,7 +107,12 @@ public function updateRepo(Repo $repo) : void $repo = array_shift($repos); if ($this->filesystem->exists($path . "/" . $repo->getName())) { - $this->git->fetchBare($path . "/" . $repo->getName(), $repo->getUrl()); + $this->git->setLocalConfig( + $path . "/" . $repo->getName(), + "remote.origin.fetch", + "+refs/heads/*:refs/remotes/origin/*" + ); + $this->git->fetchBare($path . "/" . $repo->getName()); return; } diff --git a/app/src/Lib/Git/Git.php b/app/src/Lib/Git/Git.php index fb087464..27dbe127 100644 --- a/app/src/Lib/Git/Git.php +++ b/app/src/Lib/Git/Git.php @@ -7,7 +7,7 @@ interface Git { public function getBranches(string $path) : array; - public function fetchBare(string $path, string $url) : void; + public function fetchBare(string $path) : void; public function cloneBare(string $url, string $path) : void; public function setLocalConfig(string $path, ...$commands) : void; public function checkoutRemote(string $path, string $branch) : void; diff --git a/app/src/Lib/Git/GitShell.php b/app/src/Lib/Git/GitShell.php index badf8ae3..41c132b1 100644 --- a/app/src/Lib/Git/GitShell.php +++ b/app/src/Lib/Git/GitShell.php @@ -26,7 +26,6 @@ public function getBranches(string $path) : array "-C", $path, "branch", - "-a", "--format=%(refname:short)", ]; @@ -34,17 +33,16 @@ public function getBranches(string $path) : array return array_filter(explode("\n", $this->run($cmd, $this->logger))); } - public function fetchBare(string $path, string $url) : void + public function fetchBare(string $path) : void { $cmd = [ "git", "-C", $path, - "fetch", - $url + "fetch" ]; - $this->logger->info("Fetch url '$url' to path '$path'"); + $this->logger->info("Fetch to path '$path'"); $this->run($cmd, $this->logger); } diff --git a/app/tests/Commands/Repo/RepoManagerTest.php b/app/tests/Commands/Repo/RepoManagerTest.php index 5e31884c..497ca681 100644 --- a/app/tests/Commands/Repo/RepoManagerTest.php +++ b/app/tests/Commands/Repo/RepoManagerTest.php @@ -207,7 +207,7 @@ public function test_updateRepo_with_already_existing_global_repo() : void $git ->expects($this->once()) ->method("fetchBare") - ->with("/usr/local/share/doil/repositories/global1", "https://global1.git") + ->with("/usr/local/share/doil/repositories/global1") ; $repo_manager->updateRepo($repo); @@ -244,7 +244,7 @@ public function test_updateRepo_with_already_existing_local_repo() : void $git ->expects($this->once()) ->method("fetchBare") - ->with("/home/doil/.doil/repositories/local1", "https://local1.git") + ->with("/home/doil/.doil/repositories/local1") ; $repo_manager->updateRepo($repo); diff --git a/setup/updates/update-20230223.sh b/setup/updates/update-20230308.sh similarity index 86% rename from setup/updates/update-20230223.sh rename to setup/updates/update-20230308.sh index fc5ed641..9efd3f35 100644 --- a/setup/updates/update-20230223.sh +++ b/setup/updates/update-20230308.sh @@ -4,7 +4,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source ${SCRIPT_DIR}/update.sh -doil_update_20230223() { +doil_update_20230308() { update return $? }