Skip to content

Commit 9f122e8

Browse files
ktaletskfcollonval
authored andcommitted
Add useCommitAndPush to settings & GitPanel props
1 parent 5a8df57 commit 9f122e8

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

schema/plugin.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@
5858
"title": "Simple staging flag",
5959
"description": "If true, use a simplified concept of staging. Only files with changes are shown (instead of showing staged/changed/untracked), and all files with changes will be automatically staged",
6060
"default": false
61+
},
62+
"useCommitAndPush": {
63+
"type": "boolean",
64+
"title": "Combine commit and push in one button",
65+
"description": "If true, combine commit and push in one button.",
66+
"default": false
6167
}
6268
},
6369
"jupyter.lab.shortcuts": [

src/components/CommitBox.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export interface ICommitBoxProps {
1919
*/
2020
commands: CommandRegistry;
2121

22+
/**
23+
* Boolean indicating whether to use simplified commit-and-push instead of commit button
24+
*/
25+
useCommitAndPush: boolean;
26+
2227
/**
2328
* Boolean indicating whether files currently exist which have changes to commit.
2429
*/
@@ -91,7 +96,9 @@ export class CommitBox extends React.Component<
9196
? this.props.trans.__('Disabled: No files are staged for commit')
9297
: !this.state.summary
9398
? this.props.trans.__('Disabled: No commit message summary')
94-
: this.props.trans.__('Commit');
99+
: !this.props.useCommitAndPush
100+
? this.props.trans.__('Commit')
101+
: this.props.trans.__('Commit and push');
95102

96103
const shortcutHint = CommandRegistry.formatKeystroke(
97104
this._getSubmitKeystroke()

src/components/GitPanel.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,15 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
380380
<CommitBox
381381
hasFiles={this._markedFiles.length > 0}
382382
trans={this.props.trans}
383+
useCommitAndPush={this.props.settings.composite['useCommitAndPush'] as boolean}
383384
onCommit={this.commitMarkedFiles}
384385
commands={this.props.commands}
385386
/>
386387
) : (
387388
<CommitBox
388389
hasFiles={this._hasStagedFile()}
389390
trans={this.props.trans}
391+
useCommitAndPush={this.props.settings.composite['useCommitAndPush'] as boolean}
390392
onCommit={this.commitStagedFiles}
391393
commands={this.props.commands}
392394
/>

0 commit comments

Comments
 (0)