diff --git a/apps/desktop/src/lib/branch/BranchDropzone.svelte b/apps/desktop/src/lib/branch/BranchDropzone.svelte index a3258fc3f..defd255cd 100644 --- a/apps/desktop/src/lib/branch/BranchDropzone.svelte +++ b/apps/desktop/src/lib/branch/BranchDropzone.svelte @@ -15,8 +15,9 @@ const branchController = getContext(BranchController); function accepts(data: any) { - if (data instanceof DraggableFile) return !data.files.some((f) => f.locked); - if (data instanceof DraggableHunk) return !data.hunk.locked; + if (data instanceof DraggableFile) + return !(data.isCommitted || data.files.some((f) => f.locked)); + if (data instanceof DraggableHunk) return !(data.isCommitted || data.hunk.locked); return false; } diff --git a/apps/desktop/src/lib/dragging/draggables.ts b/apps/desktop/src/lib/dragging/draggables.ts index 0fc2daef0..e2ee3fc40 100644 --- a/apps/desktop/src/lib/dragging/draggables.ts +++ b/apps/desktop/src/lib/dragging/draggables.ts @@ -21,6 +21,10 @@ export class DraggableHunk { public readonly lockedTo: HunkLock[], public readonly commitId: string | undefined ) {} + + get isCommitted(): boolean { + return !!this.commitId; + } } export class DraggableFile { @@ -35,6 +39,10 @@ export class DraggableFile { if (this.selection && this.selection.length > 0) return this.selection; return [this.file]; } + + get isCommitted(): boolean { + return !!this.commit; + } } export class DraggableCommit {