From 8d9c127940c32d96d34ecded91671cfa201012af Mon Sep 17 00:00:00 2001 From: James Brundage <+@noreply.github.com> Date: Tue, 24 Sep 2024 23:30:43 -0700 Subject: [PATCH] feat: git.log.note(s) ( Fixes #296 ) Improving performance --- Types/git.log/get_Note.ps1 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Types/git.log/get_Note.ps1 b/Types/git.log/get_Note.ps1 index ff5932f..11f560b 100644 --- a/Types/git.log/get_Note.ps1 +++ b/Types/git.log/get_Note.ps1 @@ -4,6 +4,19 @@ .DESCRIPTION Gets git notes associated with a commit. #> -Push-Location $this.GitRoot -git notes show $this.CommitHash -Pop-Location +$pushed = + if ($this.GitRoot -ne $pwd) { + Push-Location $this.GitRoot + $true + } else { + $false + } +$showNotes = git notes show $this.CommitHash *>&1 +if ($showNotes -isnot [Management.Automation.ErrorRecord]) { + $showNotes +} else { + $error.RemoveAt(0) +} +if ($pushed) { + Pop-Location +}