From 3892db1021b791fb1f25d1973f876d54336531e9 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 8 Feb 2026 20:39:07 +0800 Subject: [PATCH] update commit --- libraries/deno-git-mod.ts | 19 ++++++------------- script-meta-v2.json | 4 ++-- single-scripts/commit.ts | 6 +++--- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/libraries/deno-git-mod.ts b/libraries/deno-git-mod.ts index 7dac9c4..96d8282 100644 --- a/libraries/deno-git-mod.ts +++ b/libraries/deno-git-mod.ts @@ -1,33 +1,28 @@ -import {execCommand} from "https://script.hatter.ink/@29/deno-commons-mod.ts"; +import {execCommandAndStdout,} from "https://script.hatter.ink/@35/deno-commons-mod.ts"; import {existsSync} from "node:fs"; export async function getGitRemoteRev(): Promise { const currentBranch = await getGitCurrentBranch(); - const lsGitRemoteOrigin = await execCommand("git", [ + const lsGitRemoteOrigin = await execCommandAndStdout("git", [ "ls-remote", "origin", currentBranch, ]); - lsGitRemoteOrigin.assertSuccess(); - return lsGitRemoteOrigin.stdout.trim().split(/\s+/)[0].trim(); + return lsGitRemoteOrigin.split(/\s+/)[0].trim(); } export async function getGitCurrentBranch(): Promise { - const gitCurrentBranch = await execCommand("git", [ + return await execCommandAndStdout("git", [ "branch", "--show-current", ]); - gitCurrentBranch.assertSuccess(); - return gitCurrentBranch.stdout.trim(); } export async function getGitLocalRev(): Promise { - const gitLocalRev = await execCommand("git", [ + return await execCommandAndStdout("git", [ "rev-parse", "HEAD", ]); - gitLocalRev.assertSuccess(); - return gitLocalRev.stdout.trim(); } export class GitStatusResult { @@ -80,9 +75,7 @@ export async function getGitStatus(): Promise { const deleted: string[] = []; const untracked: string[] = []; - const gitStatus = await execCommand("git", ["status"]); - gitStatus.assertSuccess(); - const gitStatusStdout = gitStatus.stdout.trim(); + const gitStatusStdout = await execCommandAndStdout("git", ["status"]); if (gitStatusStdout.includes("nothing to commit, working tree clean")) { return null; } diff --git a/script-meta-v2.json b/script-meta-v2.json index 5efed59..d274aeb 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -54,11 +54,11 @@ "commit.ts": { "script_name": "commit.ts", "script_length": 2755, - "script_sha256": "96e18cf15582a3ec5a4b8890c5384f803d9a58b033d391ac17cfed14993bfa17", + "script_sha256": "945df29966d7e3b0ff92bf91902bef0c21b67768798b355ab39e31908cfb1e24", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/commit.ts", "single_script_file": true, "publish_time": 1769318306585, - "update_time": 1770399079953 + "update_time": 1770554341059 }, "decode-uri-component.ts": { "script_name": "decode-uri-component.ts", diff --git a/single-scripts/commit.ts b/single-scripts/commit.ts index 36fd735..a39fbce 100755 --- a/single-scripts/commit.ts +++ b/single-scripts/commit.ts @@ -3,7 +3,7 @@ import {createInterface} from "node:readline/promises"; import {stdin, stdout} from "node:process"; import {execCommandShell, log, ProcessBar, term,} from "https://script.hatter.ink/@29/deno-commons-mod.ts"; -import {getGitLocalRev, getGitRemoteRev, getGitStatus,} from "https://script.hatter.ink/@0/deno-git-mod.ts"; +import {getGitLocalRev, getGitRemoteRev, getGitStatus,} from "https://script.hatter.ink/@1/deno-git-mod.ts"; async function checkRev(): Promise { const localRev = await getGitLocalRev(); @@ -76,5 +76,5 @@ main().catch((err) => { process.exit(0); }).then(() => process.exit(0)); -// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260207T013110+08:00.MEYCIQDXoa6SfDaJ5KsDplYF -// zBZXJkEuC9HndsMQrmLMFTAXdQIhALMYnHVZNFOTYo6+COVCOmjnMPayKHNHlgfEa0siKPvb +// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T203801+08:00.MEUCIQDbILBDbvRCXYwDhr3Y +// uNsmOqJ4CoCcjMb2ASeLBp2UhQIgGhmIedvslGsekl/w7G1sviwVr2G8EftSbd9YNDipMKA=