Skip to content

Commit

Permalink
Fix import script when generating rev-list to always return a list.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stevewgr committed May 22, 2024
1 parent d398477 commit 3022fe9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion import.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit 3022fe9

Please sign in to comment.