Browse code

Windows: make.ps1 fix DCO check

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/12/08 10:47:51
Showing 1 changed files
... ...
@@ -176,6 +176,7 @@ Function Execute-Build($type, $additionalBuildTags, $directory) {
176 176
     Pop-Location; $global:pushed=$False
177 177
 }
178 178
 
179
+
179 180
 # Validates the DCO marker is present on each commit
180 181
 Function Validate-DCO($headCommit, $upstreamCommit) {
181 182
     Write-Host "INFO: Validating Developer Certificate of Origin..."
... ...
@@ -189,8 +190,12 @@ Function Validate-DCO($headCommit, $upstreamCommit) {
189 189
     if ($LASTEXITCODE -ne 0) { Throw "Failed git diff --numstat" }
190 190
 
191 191
     # Counts of adds and deletes after removing multiple white spaces. AWK anyone? :(
192
-    $adds=0; $dels=0; $($counts -replace '\s+', ' ') | %{ $a=$_.Split(" "); $adds+=[int]$a[0]; $dels+=[int]$a[1] }
193
-    if (($adds -eq 0) -and ($dels -eq 0)) {
192
+    $adds=0; $dels=0; $($counts -replace '\s+', ' ') | %{ 
193
+        $a=$_.Split(" "); 
194
+        if ($a[0] -ne "-") { $adds+=[int]$a[0] }
195
+        if ($a[1] -ne "-") { $dels+=[int]$a[1] }
196
+    }
197
+    if (($adds -eq 0) -and ($dels -eq 0)) { 
194 198
         Write-Warning "DCO validation - nothing to validate!"
195 199
         return
196 200
     }