Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed `nova bump` and `Update-NovaModuleVersion` so nested project folders now reuse parent Git repository history for bump inference instead of silently falling back to `Patch`.

### Security

## [2.3.0] - 2026-05-06
Expand Down
2 changes: 1 addition & 1 deletion src/private/release/GetGitCommitMessagesForVersionBump.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Get-GitCommitMessageForVersionBump {
[Parameter(Mandatory)][string]$ProjectRoot
)

if (-not (Test-Path -LiteralPath (Join-Path $ProjectRoot '.git'))) {
if (-not (Test-GitRepositoryIsAvailable -ProjectRoot $ProjectRoot)) {
return @()
}

Expand Down
4 changes: 0 additions & 4 deletions src/private/release/GetNovaVersionLabelForBump.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ function Test-GitRepositoryIsAvailable {
[Parameter(Mandatory)][string]$ProjectRoot
)

if (-not (Test-Path -LiteralPath (Join-Path $ProjectRoot '.git'))) {
return $false
}

$result = Invoke-NovaGitCommand -ProjectRoot $ProjectRoot -Arguments @('rev-parse', '--git-dir')
return $result.ExitCode -eq 0
}
Expand Down
22 changes: 22 additions & 0 deletions tests/CoverageGaps.ReleaseInternals.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,28 @@ Describe 'Coverage gaps for release and git internals' {
}
}

It 'Get-GitCommitMessageForVersionBump resolves parent git repositories for nested project paths' {
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Set-ItResult -Skipped -Because 'git is not available in this environment'
return
}

InModuleScope $script:moduleName {
$repositoryRoot = Join-Path $TestDrive 'parent-git-repo'
$projectRoot = Join-Path $repositoryRoot 'NestedProject'
Initialize-TestGitRepository -Path $repositoryRoot
New-Item -ItemType Directory -Path $projectRoot -Force | Out-Null
New-TestGitCommit -RepositoryPath $repositoryRoot -Message 'feat!: nested project change' -File @{
Name = 'NestedProject/feature.txt'
Content = 'feature'
}

$messages = @(Get-GitCommitMessageForVersionBump -ProjectRoot $projectRoot)

$messages | Should -Be @('feat!: nested project change')
}
}

It 'Get-NovaVersionLabelForBump falls back to Patch when the project is not a git repository' {
InModuleScope $script:moduleName {
$projectRoot = Join-Path $TestDrive 'no-git-project-for-label'
Expand Down
40 changes: 40 additions & 0 deletions tests/NovaCommandModel.StandaloneCli.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,46 @@ Describe '$projectName tests' {
}
}

It 'Install-NovaCli infers a major bump from parent Git repository history for nested project roots' {
$targetDirectory = Join-Path $TestDrive 'parent-git-bump-bin'
$installedPath = Join-Path $targetDirectory 'nova'
$repositoryRoot = Join-Path $TestDrive 'CliParentGitRepo'
$projectRoot = Join-Path $repositoryRoot 'AzureDevOpsAgentInstaller'
$projectJsonPath = Join-Path $projectRoot 'project.json'
$originalModulePath = $env:PSModulePath
$modulePathSeparator = [string][System.IO.Path]::PathSeparator
$distParent = Split-Path -Parent $script:distModuleDir

$env:PSModulePath = "$distParent$modulePathSeparator$originalModulePath"

New-Item -ItemType Directory -Path $repositoryRoot -Force | Out-Null
Initialize-TestNovaCliProjectLayout -ProjectRoot $projectRoot
Write-TestNovaCliProjectJson -ProjectRoot $projectRoot -ProjectName 'AzureDevOpsAgentInstaller' -ProjectGuid '77777777-7777-7777-7777-777777777777'
Write-TestNovaCliPublicFunction -ProjectRoot $projectRoot -FunctionName 'Invoke-TestNestedParentGitBump'

$projectData = Get-Content -LiteralPath $projectJsonPath -Raw | ConvertFrom-Json
$projectData.Version = '1.5.4-preview'
$projectData | ConvertTo-Json -Depth 20 | Set-Content -LiteralPath $projectJsonPath -Encoding utf8

try {
Initialize-TestNovaCliGitRepository -ProjectRoot $repositoryRoot -CommitMessage 'feat!: add nested parent repo bump coverage'

Install-NovaCli -DestinationDirectory $targetDirectory -Force | Out-Null

$result = Invoke-TestInstalledNovaCommand -InstalledPath $installedPath -WorkingDirectory $projectRoot -Arguments @('bump', '--what-if')
$versionAfterBump = (Get-Content -LiteralPath $projectJsonPath -Raw | ConvertFrom-Json).Version

$result.ExitCode | Should -Be 0
$result.Text | Should -Match 'What if:'
$result.Text | Should -Match 'Version plan: 1\.5\.4-preview -> 2\.0\.0 \| Label: Major \| Commits: 1'
$result.Text | Should -Not -Match 'Version plan: 1\.5\.4-preview -> 1\.5\.4 \| Label: Patch \| Commits: 0'
$versionAfterBump | Should -Be '1.5.4-preview'
}
finally {
$env:PSModulePath = $originalModulePath
}
}

It 'Install-NovaCli rejects unsupported nova init invocations with clear migration guidance' -ForEach @(
@{
Name = 'WhatIf'
Expand Down
Loading