add something
This commit is contained in:
+10
-2
@@ -95,10 +95,13 @@
|
||||
$: changedFiles = status?.files ?? [];
|
||||
$: stagedCount = status?.files.filter((f) => f.staged !== null).length ?? 0;
|
||||
$: unstagedCount = status?.files.filter((f) => f.unstaged !== null).length ?? 0;
|
||||
$: canCommit = hasRepository && stagedCount > 0 && commitMessage.trim().length > 0 && !isBusy;
|
||||
$: canCompare = hasRepository && compareFrom.length > 0 && compareTo.length > 0 && compareFrom !== compareTo && !isBusy;
|
||||
$: conflictedFiles = changedFiles.filter((f) => f.staged === "conflicted" || f.unstaged === "conflicted");
|
||||
$: hasConflicts = conflictedFiles.length > 0;
|
||||
$: canCommit = hasRepository && stagedCount > 0 && commitMessage.trim().length > 0 && !hasConflicts && !isBusy;
|
||||
$: commitBlockReason = hasConflicts
|
||||
? `${conflictedFiles.length} ${conflictedFiles.length === 1 ? "merge conflict must" : "merge conflicts must"} be resolved before committing.`
|
||||
: "";
|
||||
$: canCompare = hasRepository && compareFrom.length > 0 && compareTo.length > 0 && compareFrom !== compareTo && !isBusy;
|
||||
$: localBranches = branches.filter((b) => !b.remote);
|
||||
$: remoteBranches = branches.filter((b) => b.remote);
|
||||
|
||||
@@ -371,6 +374,10 @@
|
||||
async function commitChanges() {
|
||||
const message = commitMessage.trim();
|
||||
if (!message || !activeRepoPath) return;
|
||||
if (hasConflicts) {
|
||||
errorMessage = "Resolve all merge conflicts before committing.";
|
||||
return;
|
||||
}
|
||||
await runOperation("Committing", async () => {
|
||||
applyStatus(await commit(activeRepoPath, message));
|
||||
commitMessage = "";
|
||||
@@ -670,6 +677,7 @@
|
||||
<CommitPanel
|
||||
{commitMessage}
|
||||
{canCommit}
|
||||
{commitBlockReason}
|
||||
{hasRepository}
|
||||
{isBusy}
|
||||
{operation}
|
||||
|
||||
Reference in New Issue
Block a user