File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import * as vscode from "vscode" ;
88import { API } from "./api/git" ;
99import { makeAndFillCommitMsg } from "./autofill" ;
10+ import { getCommitTemplateName } from "./git/cli" ;
1011import { getGitExtension } from "./gitExtension" ;
1112
1213function _validateFoundRepos ( git : API ) {
@@ -57,9 +58,38 @@ async function _handleRepos(git: API, sourceControl: any) {
5758 */
5859async function _handleRepo ( git : API ) {
5960 const targetRepo = git . repositories [ 0 ] ;
61+
6062 await makeAndFillCommitMsg ( targetRepo ) ;
6163}
6264
65+ async function _autofill ( uri ?: string ) {
66+ const git = getGitExtension ( ) ;
67+
68+ if ( ! git ) {
69+ vscode . window . showErrorMessage ( "Unable to load Git Extension" ) ;
70+ return ;
71+ }
72+
73+ if ( git . repositories . length === 0 ) {
74+ vscode . window . showErrorMessage (
75+ "No repos found. Please open a repo or run git init then try this extension again."
76+ ) ;
77+ return ;
78+ }
79+
80+ vscode . commands . executeCommand ( "workbench.view.scm" ) ;
81+
82+ if ( uri ) {
83+ _handleRepos ( git , uri ) ;
84+ } else {
85+ _handleRepo ( git ) ;
86+ }
87+
88+ const templateName = await getCommitTemplateName ( )
89+ console . debug ( templateName )
90+
91+ }
92+
6393/**
6494 * Choose the relevant repo and apply autofill logic on files there.
6595 */
You can’t perform that action at this time.
0 commit comments