mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-04 03:42:38 +03:00
Prevent commit when no files selected
This commit is contained in:
parent
56b50af8ae
commit
5209087b8d
@ -63,4 +63,8 @@ export class Ownership {
|
||||
.map(([fileId, hunks]) => fileId + ':' + Array.from(hunks.values()).join(','))
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
isEmpty() {
|
||||
return this.files.size == 0;
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@
|
||||
|
||||
<div class="header" bind:this={headerElement}>
|
||||
<div class="header__left">
|
||||
{#if showCheckboxes && selectedListMode == 'list'}
|
||||
{#if showCheckboxes && selectedListMode == 'list' && branch.files.length > 1}
|
||||
<Checkbox
|
||||
small
|
||||
{checked}
|
||||
|
@ -12,7 +12,7 @@
|
||||
projectCommitGenerationUseEmojis,
|
||||
projectRunCommitHooks
|
||||
} from '$lib/config/config';
|
||||
import { Ownership } from '$lib/vbranches/ownership';
|
||||
import type { Ownership } from '$lib/vbranches/ownership';
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import DropDown from '$lib/components/DropDown.svelte';
|
||||
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
|
||||
@ -51,7 +51,6 @@
|
||||
|
||||
function commit() {
|
||||
isCommitting = true;
|
||||
selectedOwnership.set(Ownership.fromBranch(branch));
|
||||
branchController
|
||||
.commitBranch(branch.id, commitMessage, $selectedOwnership.toString(), $runCommitHooks)
|
||||
.then(() => {
|
||||
@ -203,7 +202,7 @@
|
||||
grow
|
||||
color="primary"
|
||||
kind="filled"
|
||||
disabled={(isCommitting || !commitMessage) && $expanded}
|
||||
disabled={(isCommitting || !commitMessage || $selectedOwnership.isEmpty()) && $expanded}
|
||||
id="commit-to-branch"
|
||||
on:click={() => {
|
||||
if ($expanded) {
|
||||
|
Loading…
Reference in New Issue
Block a user