дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
fix(vcs): keep local changes and staging intact across Git operations; roll back partial multi-repository operations (#1701)
* fix(vcs): keep local changes and staging intact across commit, checkout and history edits - Commit: changes left out of a commit keep their staged state. The commit is made from a copy of the index (included files staged there, excluded ones reset to HEAD), so the user's index and other repositories are untouched. - Smart Checkout restores staged changes as staged; untracked files a checkout would overwrite are listed instead of a raw git error. - Edit Commit Message rewrites the commit and its descendants without a rebase, so the working tree and local changes stay as they are. - Edit Commit Message, Drop and Squash offer Undo in their notification while the branch hasn't moved since. - Interactive rebases (Drop, Squash, Interactively Rebase) put local changes aside themselves and bring them back with their staged state once the rebase is over, also after a stop for conflicts. - Undo Commit asks for the target changelist (a new one named after the commit) and puts the commit message back into the commit message field. - Cherry-pick and revert skip commits whose changes are already applied instead of stopping with an empty commit; commits cherry-picked from a protected branch get "(cherry picked from commit …)". - Commit tool window: Commit File…, Accept Yours / Accept Theirs on conflicted files and Copy as Patch to Clipboard. * fix(vcs): restore staged changes after merge, rebase and update; roll back partial multi-repository operations - Merge, rebase, pull / Update Project and the rebase of a diverged checkout put local changes aside themselves and bring them back with --index, so staged changes stay staged (git's --autostash restored them unstaged). An operation stopped on conflicts keeps them aside until it is continued, skipped, aborted or concluded by a commit. - Checkout, New Branch, Merge, Rebase and Delete over several repositories: when one repository fails after others succeeded, ask whether to roll those back (check out the previous branch, delete the new branch, reset to the commit before, restore the branch); not when it stopped on conflicts. - Fixup… / Squash Into…: while the prepared message is in the field, the second commit button is Commit and Rebase, which commits and autosquashes the new commit into its target. - Undo on a history rewrite replaces its notification, so the link is gone once used.
Цей коміт міститься в:
1 джерело
ba8d224a46
коміт
8c381a07c4
31 files changed
+1264
-143
No files matched your search
@@ -1,6 +1,7 @@
|
||||
/** Commit tool window state shared with actions (selection, message draft). */
|
||||
import { create } from "zustand";
|
||||
import { call, commands } from "@/platform/ipc";
|
||||
import type { Commit } from "@/bindings";
|
||||
import type { CheckState } from "./changes";
|
||||
import type { CommitProblem } from "./commitChecks";
|
||||
import { currentRepo, useVcs } from "./store";
|
||||
@@ -37,6 +38,8 @@ interface CommitState {
|
||||
selectedList: string | null;
|
||||
/** Selected shelf tree key: shelf id, optionally followed by NUL and a file path. */
|
||||
selectedShelf: string | null;
|
||||
/** Commit a Fixup… / Squash Into… message was prepared for: offers Commit and Rebase. */
|
||||
fixupTarget: Commit | null;
|
||||
}
|
||||
|
||||
export type CommitTab = "changes" | "shelf" | "stashes";
|
||||
@@ -60,8 +63,17 @@ export const useCommit = create<CommitState>(() => ({
|
||||
tab: "changes",
|
||||
selectedList: null,
|
||||
selectedShelf: null,
|
||||
fixupTarget: null,
|
||||
}));
|
||||
|
||||
/** The Fixup… / Squash Into… target while the message still is the one prepared for it. */
|
||||
export function pendingFixup(message: string, target: Commit | null): Commit | null {
|
||||
if (!target) return null;
|
||||
return message.startsWith(`fixup! ${target.summary}`) || message.startsWith(`squash! ${target.summary}`)
|
||||
? target
|
||||
: null;
|
||||
}
|
||||
|
||||
function readBool(key: string, fallback: boolean): boolean {
|
||||
try {
|
||||
const v = localStorage.getItem(key);
|
||||
|
||||
Reference in new issue
Заблокувати користувача