Skip to content

Commit dd344c0

Browse files
committed
Fix whitespace issues in actions
1 parent 9cab706 commit dd344c0

15 files changed

+351
-351
lines changed

utils/actions/finalize/Register-FinalizeActionCheckout.psm1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ Import-Module -Scope Local "$PSScriptRoot/../../git.psm1"
44

55
# TODO: should check out the branch from remote as a local tracking branch
66
function Invoke-CheckoutFinalizeAction{
7-
param(
8-
[string] $HEAD,
9-
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics,
10-
[switch] $dryRun
11-
)
7+
param(
8+
[string] $HEAD,
9+
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics,
10+
[switch] $dryRun
11+
)
1212

13-
if ($dryRun) {
14-
"git checkout $HEAD"
15-
return
16-
}
17-
Assert-CleanWorkingDirectory -diagnostics $diagnostics
18-
if (-not (Get-HasErrorDiagnostic $diagnostics)) {
19-
Invoke-CheckoutBranch $HEAD -diagnostics $diagnostics
20-
}
13+
if ($dryRun) {
14+
"git checkout $HEAD"
15+
return
16+
}
17+
Assert-CleanWorkingDirectory -diagnostics $diagnostics
18+
if (-not (Get-HasErrorDiagnostic $diagnostics)) {
19+
Invoke-CheckoutBranch $HEAD -diagnostics $diagnostics
20+
}
2121
}
2222

2323
Export-ModuleMember -Function Invoke-CheckoutFinalizeAction

utils/actions/finalize/Register-FinalizeActionSetBranches.psm1

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,63 @@ Import-Module -Scope Local "$PSScriptRoot/../../git.psm1"
66
Import-Module -Scope Local "$PSScriptRoot/Register-FinalizeActionSetBranches.helpers.psm1"
77

88
function Invoke-SetBranchesFinalizeAction {
9-
param(
10-
[Parameter()] $branches,
11-
[Parameter()] $force = $false,
12-
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics,
13-
[switch] $dryRun
14-
)
9+
param(
10+
[Parameter()] $branches,
11+
[Parameter()] $force = $false,
12+
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics,
13+
[switch] $dryRun
14+
)
1515

16-
$branches = ConvertTo-Hashtable $branches
17-
$config = Get-Configuration
16+
$branches = ConvertTo-Hashtable $branches
17+
$config = Get-Configuration
1818

19-
$branches.Keys | Assert-ValidBranchName -diagnostics $diagnostics
19+
$branches.Keys | Assert-ValidBranchName -diagnostics $diagnostics
2020

21-
if ($null -ne $config.remote) {
22-
$atomicPart = $config.atomicPushEnabled ? @("--atomic") : @()
23-
$forcePart = $force ? @("--force") : @()
24-
[string[]]$branchList = ConvertTo-PushBranchList $branches
25-
if ($dryRun) {
26-
"git push $($config.remote) $atomicPart $forcePart $branchList"
27-
return
28-
}
29-
Invoke-ProcessLogs "git push $($config.remote) $atomicPart $forcePart $branchList" {
30-
git push $config.remote @atomicPart @forcePart @branchList
31-
}
32-
if ($global:LASTEXITCODE -ne 0) {
33-
Add-ErrorDiagnostic $diagnostics "Unable to push updates to $($config.remote)"
34-
}
35-
} else {
36-
$currentBranch = Get-CurrentBranch
21+
if ($null -ne $config.remote) {
22+
$atomicPart = $config.atomicPushEnabled ? @("--atomic") : @()
23+
$forcePart = $force ? @("--force") : @()
24+
[string[]]$branchList = ConvertTo-PushBranchList $branches
25+
if ($dryRun) {
26+
"git push $($config.remote) $atomicPart $forcePart $branchList"
27+
return
28+
}
29+
Invoke-ProcessLogs "git push $($config.remote) $atomicPart $forcePart $branchList" {
30+
git push $config.remote @atomicPart @forcePart @branchList
31+
}
32+
if ($global:LASTEXITCODE -ne 0) {
33+
Add-ErrorDiagnostic $diagnostics "Unable to push updates to $($config.remote)"
34+
}
35+
} else {
36+
$currentBranch = Get-CurrentBranch
3737

38-
foreach ($key in $branches.Keys) {
39-
if ($currentBranch -eq $key) {
40-
Assert-CleanWorkingDirectory -diagnostics $diagnostics
41-
if (Get-HasErrorDiagnostic $diagnostics) { continue }
38+
foreach ($key in $branches.Keys) {
39+
if ($currentBranch -eq $key) {
40+
Assert-CleanWorkingDirectory -diagnostics $diagnostics
41+
if (Get-HasErrorDiagnostic $diagnostics) { continue }
4242

43-
# update head, since it matches the branch to be "pushed"
44-
if ($dryRun) {
45-
"git reset --hard `"$($branches[$key])`""
46-
continue
47-
}
48-
Invoke-ProcessLogs "git reset --hard $($branches[$key])" {
49-
git reset --hard "$($branches[$key])"
50-
}
51-
} else {
52-
# just update the branch
53-
if ($dryRun) {
54-
"git branch $key `"$($branches[$key])`" -f"
55-
continue
56-
}
57-
Invoke-ProcessLogs "git branch $key $($branches[$key])" {
58-
git branch $key "$($branches[$key])" -f
59-
}
43+
# update head, since it matches the branch to be "pushed"
44+
if ($dryRun) {
45+
"git reset --hard `"$($branches[$key])`""
46+
continue
47+
}
48+
Invoke-ProcessLogs "git reset --hard $($branches[$key])" {
49+
git reset --hard "$($branches[$key])"
50+
}
51+
} else {
52+
# just update the branch
53+
if ($dryRun) {
54+
"git branch $key `"$($branches[$key])`" -f"
55+
continue
6056
}
61-
if ($global:LASTEXITCODE -ne 0) {
62-
Add-ErrorDiagnostic $diagnostics "Unable to update local branches"
57+
Invoke-ProcessLogs "git branch $key $($branches[$key])" {
58+
git branch $key "$($branches[$key])" -f
6359
}
6460
}
61+
if ($global:LASTEXITCODE -ne 0) {
62+
Add-ErrorDiagnostic $diagnostics "Unable to update local branches"
63+
}
6564
}
65+
}
6666
}
6767

6868
Export-ModuleMember -Function Invoke-SetBranchesFinalizeAction

utils/actions/finalize/Register-FinalizeActionTrack.psm1

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,66 @@ Import-Module -Scope Local "$PSScriptRoot/../../query-state.psm1"
55
Import-Module -Scope Local "$PSScriptRoot/../../git.psm1"
66

77
function Invoke-TrackFinalizeAction {
8-
param(
9-
[Parameter()][AllowEmptyCollection()][string[]] $branches,
10-
[Parameter()][bool] $createIfNotTracked,
11-
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics,
12-
[switch] $dryRun
13-
)
14-
[string[]] $tracked = @()
15-
$config = Get-Configuration
16-
if ($null -eq $config.remote) {
17-
if ($dryRun) {
18-
return
19-
}
20-
return $tracked
8+
param(
9+
[Parameter()][AllowEmptyCollection()][string[]] $branches,
10+
[Parameter()][bool] $createIfNotTracked,
11+
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics,
12+
[switch] $dryRun
13+
)
14+
[string[]] $tracked = @()
15+
$config = Get-Configuration
16+
if ($null -eq $config.remote) {
17+
if ($dryRun) {
18+
return
2119
}
20+
return $tracked
21+
}
2222

23-
$currentBranch = Get-CurrentBranch
24-
foreach ($branch in $branches) {
25-
$localBranch = Get-LocalBranchForRemote $branch
26-
if (-not $localBranch -AND $currentBranch -eq $branch) {
27-
# current branch matches tracked one, but doesn't currently track the remote
28-
$localBranch = $currentBranch
29-
if ($dryRun) {
30-
"git branch $localBranch --set-upstream-to `"refs/remotes/$($config.remote)/$branch`""
31-
} else {
32-
Invoke-ProcessLogs "git branch $localBranch --set-upstream-to refs/remotes/$($config.remote)/$branch" {
33-
git branch $localBranch --set-upstream-to "refs/remotes/$($config.remote)/$branch"
34-
}
23+
$currentBranch = Get-CurrentBranch
24+
foreach ($branch in $branches) {
25+
$localBranch = Get-LocalBranchForRemote $branch
26+
if (-not $localBranch -AND $currentBranch -eq $branch) {
27+
# current branch matches tracked one, but doesn't currently track the remote
28+
$localBranch = $currentBranch
29+
if ($dryRun) {
30+
"git branch $localBranch --set-upstream-to `"refs/remotes/$($config.remote)/$branch`""
31+
} else {
32+
Invoke-ProcessLogs "git branch $localBranch --set-upstream-to refs/remotes/$($config.remote)/$branch" {
33+
git branch $localBranch --set-upstream-to "refs/remotes/$($config.remote)/$branch"
3534
}
3635
}
37-
38-
if ($currentBranch -eq $localBranch) {
39-
# update head
40-
Assert-CleanWorkingDirectory -diagnostics $diagnostics
41-
if (Get-HasErrorDiagnostic $diagnostics) { continue }
42-
if ($dryRun) {
43-
"git reset --hard `"refs/remotes/$($config.remote)/$branch`""
44-
} else {
45-
Invoke-ProcessLogs "git reset --hard refs/remotes/$($config.remote)/$branch" {
46-
git reset --hard "refs/remotes/$($config.remote)/$branch"
47-
}
48-
}
49-
} elseif ($localBranch -OR $createIfNotTracked) {
50-
$localBranch = $localBranch ? $localBranch : $branch
51-
# update
52-
if ($dryRun) {
53-
"git branch $localBranch `"refs/remotes/$($config.remote)/$branch`" -f"
54-
} else {
55-
Invoke-ProcessLogs "git branch $localBranch refs/remotes/$($config.remote)/$branch -f" {
56-
git branch $localBranch "refs/remotes/$($config.remote)/$branch" -f
57-
}
36+
}
37+
38+
if ($currentBranch -eq $localBranch) {
39+
# update head
40+
Assert-CleanWorkingDirectory -diagnostics $diagnostics
41+
if (Get-HasErrorDiagnostic $diagnostics) { continue }
42+
if ($dryRun) {
43+
"git reset --hard `"refs/remotes/$($config.remote)/$branch`""
44+
} else {
45+
Invoke-ProcessLogs "git reset --hard refs/remotes/$($config.remote)/$branch" {
46+
git reset --hard "refs/remotes/$($config.remote)/$branch"
5847
}
48+
}
49+
} elseif ($localBranch -OR $createIfNotTracked) {
50+
$localBranch = $localBranch ? $localBranch : $branch
51+
# update
52+
if ($dryRun) {
53+
"git branch $localBranch `"refs/remotes/$($config.remote)/$branch`" -f"
5954
} else {
60-
continue
55+
Invoke-ProcessLogs "git branch $localBranch refs/remotes/$($config.remote)/$branch -f" {
56+
git branch $localBranch "refs/remotes/$($config.remote)/$branch" -f
57+
}
6158
}
62-
$tracked += $branch
59+
} else {
60+
continue
6361
}
62+
$tracked += $branch
63+
}
6464

65-
if (-not $dryRun) {
66-
return $tracked
67-
}
65+
if (-not $dryRun) {
66+
return $tracked
67+
}
6868
}
6969

7070
Export-ModuleMember -Function Invoke-TrackFinalizeAction

utils/actions/local/Register-LocalActionAssertExistence.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Invoke-AssertBranchExistenceLocalAction {
1010
)
1111

1212
$remote = $(Get-Configuration).remote
13-
13+
1414
foreach ($branch in $branches) {
1515
$actualBranch = ($remote) ? "$remote/$branch" : $branch
1616
Invoke-ProcessLogs "git rev-parse --verify $actualBranch" {

utils/actions/local/Register-LocalActionAssertPushed.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Invoke-AssertBranchPushedLocalAction {
1717
} elseif ($remoteMustExist -AND -not $state) {
1818
Add-ErrorDiagnostic $diagnostics "The local branch for $target does not exist on the remote"
1919
}
20-
20+
2121
return @{}
2222
}
2323

utils/actions/local/Register-LocalActionAssertUpdated.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function Invoke-AssertBranchUpToDateLocalAction {
2525
} elseif ($mergeResult.hasChanges) {
2626
Add-ErrorDiagnostic $diagnostics "The branch $upstream has changes that are not in $downstream"
2727
}
28-
28+
2929
return @{}
3030
}
3131

utils/actions/local/Register-LocalActionEvaluate.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function Register-LocalActionEvaluate([PSObject] $localActions) {
88
[Parameter(Mandatory)][AllowNull()][object] $result,
99
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics
1010
)
11-
11+
1212
return $result
1313
}
1414
}

utils/actions/local/Register-LocalActionFilterBranches.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ function Invoke-FilterBranchesLocalAction {
66
param(
77
[Parameter()][AllowEmptyCollection()][string[]] $include,
88
[Parameter()][AllowEmptyCollection()][string[]] $exclude,
9-
9+
1010
[Parameter()][AllowNull()][AllowEmptyCollection()][System.Collections.ArrayList] $diagnostics
1111
)
1212

1313
[string[]]$result = $include | Where-Object { $_ } | Where-Object { $_ -notin $exclude } | Get-Unique
14-
14+
1515
return $result
1616
}
1717

utils/actions/local/Register-LocalActionGetUpstream.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function Invoke-GetUpstreamLocalAction {
1212
)
1313

1414
[string[]]$result = Select-UpstreamBranches -branchName $target -recurse:$recurse -includeRemote:$includeRemote -overrideUpstreams:$overrideUpstreams
15-
15+
1616
return $result
1717
}
1818

0 commit comments

Comments
 (0)