Skip to content

Commit 55a40db

Browse files
committed
Merge branch 'upstream-development'
2 parents 04a5bd7 + dd73c6f commit 55a40db

13 files changed

Lines changed: 105 additions & 35 deletions

app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"productName": "GitHub Desktop Plus",
66
"bundleID": "com.github.GitHubClient",
77
"companyName": "GitHub, Inc.",
8-
"version": "3.5.6-beta1",
8+
"version": "3.5.7-beta1",
99
"main": "./main.js",
1010
"repository": {
1111
"type": "git",
@@ -36,7 +36,7 @@
3636
"desktop-trampoline": "file:../vendor/desktop-trampoline",
3737
"dexie": "^3.2.3",
3838
"dompurify": "^3.3.1",
39-
"dugite": "^3.2.0",
39+
"dugite": "^3.2.1",
4040
"electron-window-state": "^5.0.3",
4141
"event-kit": "^2.0.0",
4242
"focus-trap-react": "^8.1.0",

app/src/lib/app-state.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,18 @@ export interface IRepositoryState {
632632
* by means of passing the `--no-verify` flag to git commit
633633
*/
634634
readonly skipCommitHooks: boolean
635+
636+
/**
637+
* Whether or not to add a `Signed-off-by` trailer to commit messages
638+
* by means of passing the `--signoff` flag to git commit
639+
*/
640+
readonly signOffCommits: boolean
635641
}
636642

637-
export type CommitOptions = Pick<IRepositoryState, 'skipCommitHooks'>
643+
export type CommitOptions = Pick<
644+
IRepositoryState,
645+
'skipCommitHooks' | 'signOffCommits'
646+
>
638647

639648
export interface IBranchesState {
640649
/**

app/src/lib/git/commit.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export async function createCommit(
1919
options?: {
2020
amend?: boolean
2121
noVerify?: boolean
22+
signOff?: boolean
2223
} & HookCallbackOptions
2324
): Promise<string> {
2425
// Clear the staging area, our diffs reflect the difference between the
@@ -38,6 +39,10 @@ export async function createCommit(
3839
args.push('--no-verify')
3940
}
4041

42+
if (options?.signOff) {
43+
args.push('--signoff')
44+
}
45+
4146
const result = await git(
4247
['commit', ...args],
4348
repository.path,

app/src/lib/stores/app-store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3631,6 +3631,7 @@ export class AppStore extends TypedBaseStore<IAppState> {
36313631
}))
36323632
},
36333633
noVerify: state.skipCommitHooks,
3634+
signOff: state.signOffCommits,
36343635
}).catch(err => (aborted ? undefined : Promise.reject(err)))
36353636
},
36363637
{ gitContext: { kind: 'commit' }, repository }

app/src/lib/stores/repository-state-cache.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,5 +395,6 @@ function getInitialRepositoryState(): IRepositoryState {
395395
multiCommitOperationState: null,
396396
hasCommitHooks: false,
397397
skipCommitHooks: false,
398+
signOffCommits: false,
398399
}
399400
}

app/src/ui/app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,7 @@ export class App extends React.Component<IAppProps, IAppState> {
22302230
accounts={this.state.accounts}
22312231
hasCommitHooks={repositoryState.hasCommitHooks}
22322232
skipCommitHooks={repositoryState.skipCommitHooks}
2233+
signOffCommits={repositoryState.signOffCommits}
22332234
onUpdateCommitOptions={this.onUpdateCommitOptions}
22342235
/>
22352236
)
@@ -3652,6 +3653,7 @@ export class App extends React.Component<IAppProps, IAppState> {
36523653
}
36533654
hasCommitHooks={selectedState.state.hasCommitHooks}
36543655
skipCommitHooks={selectedState.state.skipCommitHooks}
3656+
signOffCommits={selectedState.state.signOffCommits}
36553657
onUpdateCommitOptions={this.onUpdateCommitOptions}
36563658
/>
36573659
)

app/src/ui/changes/commit-message.tsx

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ interface ICommitMessageProps {
214214
*/
215215
readonly skipCommitHooks: boolean
216216

217+
/**
218+
* Whether or not to add a `Signed-off-by` trailer to commit messages
219+
* by means of passing the `--signoff` flag to git commit
220+
*/
221+
readonly signOffCommits: boolean
222+
217223
/** Callback to set commit options for the given repository */
218224
readonly onUpdateCommitOptions: (
219225
repository: Repository,
@@ -1012,10 +1018,6 @@ export class CommitMessage extends React.Component<
10121018
}
10131019

10141020
private renderCommitOptionsButton() {
1015-
if (!this.isCommitOptionsButtonEnabled) {
1016-
return null
1017-
}
1018-
10191021
const ariaLabel = 'Configure commit options'
10201022

10211023
return (
@@ -1025,7 +1027,8 @@ export class CommitMessage extends React.Component<
10251027
)}
10261028
<Button
10271029
className={classNames('commit-options-button', {
1028-
'default-options': !this.props.skipCommitHooks,
1030+
'default-options':
1031+
!this.props.skipCommitHooks && !this.props.signOffCommits,
10291032
})}
10301033
onClick={this.onCommitOptionsButtonClick}
10311034
ariaLabel={ariaLabel}
@@ -1041,18 +1044,38 @@ export class CommitMessage extends React.Component<
10411044
e: React.MouseEvent<HTMLButtonElement>
10421045
) => {
10431046
e.preventDefault()
1044-
showContextualMenu([
1045-
{
1047+
1048+
const items: IMenuItem[] = []
1049+
1050+
if (enableHooksEnvironment() && this.props.hasCommitHooks) {
1051+
items.push({
10461052
type: 'checkbox',
10471053
checked: this.props.skipCommitHooks,
10481054
label: __DARWIN__ ? 'Bypass Commit Hooks' : 'Bypass Commit hooks',
10491055
action: () => {
10501056
this.props.onUpdateCommitOptions(this.props.repository, {
10511057
skipCommitHooks: !this.props.skipCommitHooks,
1058+
signOffCommits: this.props.signOffCommits,
10521059
})
10531060
},
1061+
})
1062+
}
1063+
1064+
items.push({
1065+
type: 'checkbox',
1066+
checked: this.props.signOffCommits,
1067+
label: __DARWIN__
1068+
? 'Add Signed-off-by Trailer'
1069+
: 'Add Signed-off-by trailer',
1070+
action: () => {
1071+
this.props.onUpdateCommitOptions(this.props.repository, {
1072+
skipCommitHooks: this.props.skipCommitHooks,
1073+
signOffCommits: !this.props.signOffCommits,
1074+
})
10541075
},
1055-
])
1076+
})
1077+
1078+
showContextualMenu(items)
10561079
}
10571080

10581081
private renderCoAuthorToggleButton() {
@@ -1143,26 +1166,7 @@ export class CommitMessage extends React.Component<
11431166
)
11441167
}
11451168

1146-
private get isCommitOptionsButtonEnabled() {
1147-
return enableHooksEnvironment() && this.props.hasCommitHooks
1148-
}
1149-
1150-
/**
1151-
* Whether or not there's anything to render in the action bar
1152-
*/
1153-
private get isActionBarEnabled() {
1154-
return (
1155-
this.isCoAuthorInputEnabled ||
1156-
this.isCopilotButtonEnabled ||
1157-
this.isCommitOptionsButtonEnabled
1158-
)
1159-
}
1160-
11611169
private renderActionBar() {
1162-
if (!this.isActionBarEnabled) {
1163-
return null
1164-
}
1165-
11661170
const { isCommitting, isGeneratingCommitMessage } = this.props
11671171

11681172
const className = classNames('action-bar', {
@@ -1657,7 +1661,7 @@ export class CommitMessage extends React.Component<
16571661

16581662
public render() {
16591663
const className = classNames('commit-message-component', {
1660-
'with-action-bar': this.isActionBarEnabled,
1664+
'with-action-bar': true,
16611665
'with-co-authors': this.isCoAuthorInputVisible,
16621666
})
16631667

app/src/ui/changes/filter-changes-list.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ interface IFilterChangesListProps {
245245
*/
246246
readonly skipCommitHooks: boolean
247247

248+
/**
249+
* Whether or not to add a `Signed-off-by` trailer to commit messages
250+
* by means of passing the `--signoff` flag to git commit
251+
*/
252+
readonly signOffCommits: boolean
253+
248254
/** Callback to set commit options for the given repository */
249255
readonly onUpdateCommitOptions: (
250256
repository: Repository,
@@ -1073,6 +1079,7 @@ export class FilterChangesList extends React.Component<
10731079
submitButtonAriaDescribedBy={'hidden-changes-warning'}
10741080
hasCommitHooks={this.props.hasCommitHooks}
10751081
skipCommitHooks={this.props.skipCommitHooks}
1082+
signOffCommits={this.props.signOffCommits}
10761083
onUpdateCommitOptions={this.props.onUpdateCommitOptions}
10771084
/>
10781085
)

app/src/ui/changes/sidebar.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ interface IChangesSidebarProps {
109109
*/
110110
readonly skipCommitHooks: boolean
111111

112+
/**
113+
* Whether or not to add a `Signed-off-by` trailer to commit messages
114+
* by means of passing the `--signoff` flag to git commit
115+
*/
116+
readonly signOffCommits: boolean
117+
112118
/** Callback to set commit options for the given repository */
113119
readonly onUpdateCommitOptions: (
114120
repository: Repository,
@@ -491,6 +497,7 @@ export class ChangesSidebar extends React.Component<IChangesSidebarProps, {}> {
491497
showChangesFilter={this.props.showChangesFilter}
492498
hasCommitHooks={this.props.hasCommitHooks}
493499
skipCommitHooks={this.props.skipCommitHooks}
500+
signOffCommits={this.props.signOffCommits}
494501
onUpdateCommitOptions={this.props.onUpdateCommitOptions}
495502
/>
496503
{this.renderUndoCommit(rebaseConflictState)}

app/src/ui/commit-message/commit-message-dialog.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ interface ICommitMessageDialogProps {
108108
*/
109109
readonly skipCommitHooks: boolean
110110

111+
/**
112+
* Whether or not to add a `Signed-off-by` trailer to commit messages
113+
* by means of passing the `--signoff` flag to git commit
114+
*/
115+
readonly signOffCommits: boolean
116+
111117
/** Callback to set commit options for the given repository */
112118
readonly onUpdateCommitOptions: (
113119
repository: Repository,
@@ -187,6 +193,7 @@ export class CommitMessageDialog extends React.Component<
187193
onShowCommitProgress={undefined}
188194
hasCommitHooks={this.props.hasCommitHooks}
189195
skipCommitHooks={this.props.skipCommitHooks}
196+
signOffCommits={this.props.signOffCommits}
190197
onUpdateCommitOptions={this.props.onUpdateCommitOptions}
191198
/>
192199
</DialogContent>

0 commit comments

Comments
 (0)