@@ -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
0 commit comments