mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-10 00:05:27 +00:00
* adding branch support * gitsync settings refactor * promotionOverride * require branches and initialize them * branches -> git_branches * profiles * format * format * only warn instead of error when branches: not set in git context * error handling * formatting * modal job handling improvement * respect --yes * logging + apply effective settings * nit * ui updates * npm check * Update frontend/src/lib/components/git_sync/PullWorkspaceModal.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * hubpaths --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
30 lines
690 B
TypeScript
30 lines
690 B
TypeScript
import { log } from "../../deps.ts";
|
|
import { execSync } from "node:child_process";
|
|
|
|
export function getCurrentGitBranch(): string | null {
|
|
try {
|
|
const result = execSync("git rev-parse --abbrev-ref HEAD", {
|
|
encoding: "utf8",
|
|
stdio: "pipe"
|
|
});
|
|
const branch = result.trim();
|
|
return branch || null;
|
|
} catch (error) {
|
|
log.debug(`Failed to get Git branch: ${error}`);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function isGitRepository(): boolean {
|
|
try {
|
|
execSync("git rev-parse --git-dir", {
|
|
encoding: "utf8",
|
|
stdio: "pipe"
|
|
});
|
|
return true;
|
|
} catch (error) {
|
|
log.debug(`Failed to check Git repository: ${error}`);
|
|
return false;
|
|
}
|
|
}
|