Skip to content

Commit

Permalink
Add check for splitsh-lite
Browse files Browse the repository at this point in the history
  • Loading branch information
twose committed Apr 27, 2022
1 parent a4c42fd commit c8a9d64
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/split.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use function Swow\Util\check;
use function Swow\Util\error;
use function Swow\Util\log;
use function Swow\Util\passthru;
use function Swow\Util\success;

Expand Down Expand Up @@ -50,7 +51,12 @@
error("Repo {$repoName}'s path '{$repoPath}' is unavailable");
}
passthru("git remote add {$repoName} git@github.com:swow/{$repoName}.git >/dev/null 2>&1");
$sha1 = trim(shell_exec("splitsh-lite --prefix={$repoPath} 2>/dev/null"));
$sha1GetCommand = "splitsh-lite --prefix={$repoPath} 2>/dev/null";
log("> {$sha1GetCommand}");
$sha1 = trim((string) shell_exec($sha1GetCommand));
if (preg_match('/^[a-fA-F0-9]{40}$/', $sha1) !== 1) {
error("splitsh failed with [{$repoName}]({$repoPath})");
}
$status = passthru("git push {$repoName} {$sha1}:refs/heads/{$targetBranch} -f 2>&1");
passthru("git remote rm {$repoName} >/dev/null 2>&1");
check($status === 0, "Update {$repoName}");
Expand Down

0 comments on commit c8a9d64

Please sign in to comment.