Skip to content

Commit

Permalink
update extension.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelCurrin committed Oct 10, 2021
1 parent 460542a commit 639e650
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ function _validateFoundRepos(git: API) {
* Run autofill against one of multiples in the workspace.
*
* This is a rare flow.
*
* @param sourceControl Of type `vscode.SourceControl` with public `.rootUri`
* and private `.rootUri`.
*/
async function _handleRepos(git: API, uri: any) {
async function _handleRepos(git: API, sourceControl: any) {
// FIXME: Unfortunately this seems to only pick up the first repo and not find
// second, etc.
const selectedRepository = git.repositories.find(repository => {
console.debug({ uri, _rootUri: uri._rootUri });
if (!uri._rootUri) {
const uri = sourceControl._rootUri;
if (!uri) {
console.warn("_rootUri not set");
}
return repository.rootUri.path === uri._rootUri.path;
return repository.rootUri.path === uri.path;
});

if (selectedRepository) {
Expand Down Expand Up @@ -92,6 +95,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage(
`Generating commit message because file was saved - ${e.fileName}`
);
// TODO: Handle multiple repos by passing `sourceControl` or `uri`.
_chooseRepoForAutofill();
})
);
Expand Down

0 comments on commit 639e650

Please sign in to comment.