mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 02:26:14 +03:00
Merge pull request #5177 from gitbutlerapp/branch
fix: New branch dropzone only accepts uncommited files
This commit is contained in:
commit
08b29a7176
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user