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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user