From 4c9d7b59b7fcd3bba28124e153ee3f3f4f147798 Mon Sep 17 00:00:00 2001 From: blono Date: Wed, 24 Apr 2024 00:29:33 +0900 Subject: [PATCH] Supports the specification that repository.ui.selected is always false when there is only one repository --- src/LastCommitMessage.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/LastCommitMessage.ts b/src/LastCommitMessage.ts index 6895fce..7d84240 100644 --- a/src/LastCommitMessage.ts +++ b/src/LastCommitMessage.ts @@ -36,8 +36,16 @@ export class LastCommitMessage { } } + private chooseRepository() { + if (this._gitAPI.repositories.length == 1) { + return this._gitAPI.repositories[0]; + } else { + return this._gitAPI.repositories.find(x => x.ui.selected); + } + } + async chooseLastCommitMessage() { - const selectedRep = this._gitAPI.repositories.find(x => x.ui.selected); + const selectedRep = this.chooseRepository(); if (selectedRep != null) {