@@ -164,6 +164,39 @@ export class GitPanel extends React.Component<
164164 this . setState ( { isHistoryVisible : ! this . state . isHistoryVisible } ) ;
165165 } ;
166166
167+ /**
168+ * Commits all marked files.
169+ *
170+ * @param message - commit message
171+ * @returns a promise which commits the files
172+ */
173+ commitMarkedFiles = async ( message : string ) : Promise < void > => {
174+ await this . props . model . reset ( ) ;
175+ await this . props . model . add ( ...this . _markedFiles . map ( file => file . to ) ) ;
176+ await this . commitStagedFiles ( message ) ;
177+ } ;
178+
179+ /**
180+ * Commits all staged files.
181+ *
182+ * @param message - commit message
183+ * @returns a promise which commits the files
184+ */
185+ commitStagedFiles = async ( message : string ) : Promise < void > => {
186+ try {
187+ if (
188+ message &&
189+ message !== '' &&
190+ ( await this . _hasIdentity ( this . props . model . pathRepository ) )
191+ ) {
192+ await this . props . model . commit ( message ) ;
193+ }
194+ } catch ( error ) {
195+ console . error ( error ) ;
196+ showErrorMessage ( 'Fail to commit' , error ) ;
197+ }
198+ } ;
199+
167200 render ( ) {
168201 let filelist : React . ReactElement ;
169202 let main : React . ReactElement ;
@@ -195,14 +228,14 @@ export class GitPanel extends React.Component<
195228 msg = (
196229 < CommitBox
197230 hasFiles = { this . _markedFiles . length > 0 }
198- onCommit = { this . _commitMarkedFiles }
231+ onCommit = { this . commitMarkedFiles }
199232 />
200233 ) ;
201234 } else {
202235 msg = (
203236 < CommitBox
204237 hasFiles = { this . state . stagedFiles . length > 0 }
205- onCommit = { this . _commitStagedFiles }
238+ onCommit = { this . commitStagedFiles }
206239 />
207240 ) ;
208241 }
@@ -271,39 +304,6 @@ export class GitPanel extends React.Component<
271304 ) ;
272305 }
273306
274- /**
275- * Commits all marked files.
276- *
277- * @param message - commit message
278- * @returns a promise which commits the files
279- */
280- private _commitMarkedFiles = async ( message : string ) : Promise < void > => {
281- await this . props . model . reset ( ) ;
282- await this . props . model . add ( ...this . _markedFiles . map ( file => file . to ) ) ;
283- await this . _commitStagedFiles ( message ) ;
284- } ;
285-
286- /**
287- * Commits all staged files.
288- *
289- * @param message - commit message
290- * @returns a promise which commits the files
291- */
292- private _commitStagedFiles = async ( message : string ) : Promise < void > => {
293- try {
294- if (
295- message &&
296- message !== '' &&
297- ( await this . _hasIdentity ( this . props . model . pathRepository ) )
298- ) {
299- await this . props . model . commit ( message ) ;
300- }
301- } catch ( error ) {
302- console . error ( error ) ;
303- showErrorMessage ( 'Fail to commit' , error ) ;
304- }
305- } ;
306-
307307 /**
308308 * List of modified files (both staged and unstaged).
309309 */
0 commit comments