Skip to content

Commit

Permalink
Revert "Fix get default branch failed when Git has not set trace bran…
Browse files Browse the repository at this point in the history
…ch (#60)" (#61)

This reverts commit 30e6afb.
  • Loading branch information
kayw-geek authored Oct 19, 2023
1 parent 30e6afb commit 106b6e2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/Release/ReleaseWorker/TagVersionReleaseWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
public function shouldConfirm(): array
{
return [
'whenTrue' => static fn(): bool => self::getDefaultBranch() !== null && self::getCurrentBranch() !== self::getDefaultBranch(),
'whenTrue' => fn(): bool => self::getDefaultBranch() !== null && self::getCurrentBranch() !== self::getDefaultBranch(),
'message'=> sprintf('Do you want to release it on the [ %s ] branch?',self::getCurrentBranch())
];
}
Expand Down Expand Up @@ -63,9 +63,8 @@ private function getCurrentBranch(): ?string

private function getDefaultBranch(): ?string
{
exec('git remote set-head origin -a');
exec("git symbolic-ref --short refs/remotes/origin/HEAD | cut -d '/' -f 2",$outputs,$result_code);
exec("git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'",$outputs,$result_code);

return $result_code === 0 ? $outputs[0] ?? null : null;
return $result_code === 0 ? $outputs[0] : null;
}
}

0 comments on commit 106b6e2

Please sign in to comment.