update commit
This commit is contained in:
@@ -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<string> {
|
||||
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<string> {
|
||||
const gitCurrentBranch = await execCommand("git", [
|
||||
return await execCommandAndStdout("git", [
|
||||
"branch",
|
||||
"--show-current",
|
||||
]);
|
||||
gitCurrentBranch.assertSuccess();
|
||||
return gitCurrentBranch.stdout.trim();
|
||||
}
|
||||
|
||||
export async function getGitLocalRev(): Promise<string> {
|
||||
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<GitStatusResult | null> {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<boolean> {
|
||||
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=
|
||||
|
||||
Reference in New Issue
Block a user