File tree 1 file changed +15
-8
lines changed
1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ function Get-DefaultBranch {
33
33
[string ]$Url
34
34
)
35
35
$output = git ls- remote -- symref $Url HEAD
36
- [BranchInfo ]::new($shaPattern.Match ($output ).Value, $branchPattern.Match ($output ).Value)
36
+ if ($output ) {
37
+ [BranchInfo ]::new($shaPattern.Match ($output ).Value, $branchPattern.Match ($output ).Value)
38
+ }
37
39
}
38
40
39
41
function Get-OutdatedRemotes {
@@ -53,18 +55,23 @@ function Get-OutdatedRemotes {
53
55
Write-Host " `t $remoteName " - ForegroundColor Cyan - NoNewline
54
56
$branchRemote = Get-DefaultBranch $remoteUrl
55
57
56
- if ($branchRemote.SHA -eq $masterBranch.SHA ) {
57
- Write-Host " [OK]" - ForegroundColor Green
58
+ if ($branchRemote ) {
59
+ if ($branchRemote.SHA -eq $masterBranch.SHA ) {
60
+ Write-Host " [OK]" - ForegroundColor Green
61
+ }
62
+ else {
63
+ Write-Host " [MISSMATCH]" - ForegroundColor Red
64
+ Write-Host " Master SHA: $ ( $masterBranch.SHA ) " - ForegroundColor Yellow
65
+ Write-Host " Remote SHA: $ ( $branchRemote.SHA ) " - ForegroundColor Yellow
66
+ $_
67
+ }
58
68
}
59
69
else {
60
- Write-Host " [MISSMATCH]" - ForegroundColor Red
61
- Write-Host " Master SHA: $ ( $masterBranch.SHA ) " - ForegroundColor Yellow
62
- Write-Host " Remote SHA: $ ( $branchRemote.SHA ) " - ForegroundColor Yellow
70
+ Write-Host " [MISSING]" - ForegroundColor Red
71
+ write-host " Default branch not found" - ForegroundColor Yellow
63
72
$_
64
73
}
65
74
}
66
-
67
-
68
75
}
69
76
70
77
Clear-Host
You can’t perform that action at this time.
0 commit comments