From 3022fe9b236f20b0b7219b6c8e537d35c5925e01 Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Wed, 22 May 2024 01:42:54 -0400 Subject: [PATCH] Fix import script when generating rev-list to always return a list. Note that in a situation where running the script with -generate_diffs and only 1 migration script is running, the rev-list will return only a single commit, which will be treated as a string instead of a list. Therefore when indexing it with commits[0], in a case of a string, it will return the first character instead of the first string as would be expected. --- import.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import.ps1 b/import.ps1 index d7e67e7..07dbac6 100644 --- a/import.ps1 +++ b/import.ps1 @@ -123,7 +123,7 @@ function RunMigrationScriptsAndGenerateDiffs { git commit -m $tempUniqueCommitMessage } # Note that we're intentionally doing it this way, to be sure that we're not deleting commits we shouldn't - $commits = git rev-list --grep="$tempUniqueCommitMessage" --reverse HEAD + $commits = @(git rev-list --grep="$tempUniqueCommitMessage" --reverse HEAD) if ($commits.Count) { git reset --hard "$($commits[0])^1" }