Skip to content

ref: improve deploy testing with -C git command #92

@rulasg

Description

@rulasg

Refactor deploy testing as it's too complicated and messy.

Refactor this function to avoid changing location. Use -C parameter or git

function Reset-Manifest{
    [CmdletBinding(SupportsShouldProcess)]
    param()

    Push-Location . -StackName ResetManifest

    $manifestPath | Split-Path -Parent | Set-Location 

    # Check git status and see if manifest is dirty
    $status = git status --porcelain $manifestPath

    if ($status) {
        # Manifest is dirty, restore it
        if ($PSCmdlet.ShouldProcess($manifestPath, "git restore")) {
            git restore $manifestPath
        }
    }

    Pop-Location -StackName ResetManifest
}

Metadata

Metadata

Assignees

Labels

refactorImprovement on the code not on the functionality

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions