From b18516e6ac95c3adb4c9210ca92aa3dab1835b8d Mon Sep 17 00:00:00 2001 From: John Howard <jhoward@microsoft.com> Date: Wed, 7 Dec 2016 17:47:51 -0800 Subject: [PATCH] Windows: make.ps1 fix DCO check Signed-off-by: John Howard <jhoward@microsoft.com> (cherry picked from commit e538c1fdca16cadf59f1d19df75857c8b2c4af06) Signed-off-by: Victor Vieux <vieux@docker.com> --- hack/make.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hack/make.ps1 b/hack/make.ps1 index cb8bc72198..c085902ab6 100644 --- a/hack/make.ps1 +++ b/hack/make.ps1 @@ -176,6 +176,7 @@ Function Execute-Build($type, $additionalBuildTags, $directory) { Pop-Location; $global:pushed=$False } + # Validates the DCO marker is present on each commit Function Validate-DCO($headCommit, $upstreamCommit) { Write-Host "INFO: Validating Developer Certificate of Origin..." @@ -189,8 +190,12 @@ Function Validate-DCO($headCommit, $upstreamCommit) { if ($LASTEXITCODE -ne 0) { Throw "Failed git diff --numstat" } # Counts of adds and deletes after removing multiple white spaces. AWK anyone? :( - $adds=0; $dels=0; $($counts -replace '\s+', ' ') | %{ $a=$_.Split(" "); $adds+=[int]$a[0]; $dels+=[int]$a[1] } - if (($adds -eq 0) -and ($dels -eq 0)) { + $adds=0; $dels=0; $($counts -replace '\s+', ' ') | %{ + $a=$_.Split(" "); + if ($a[0] -ne "-") { $adds+=[int]$a[0] } + if ($a[1] -ne "-") { $dels+=[int]$a[1] } + } + if (($adds -eq 0) -and ($dels -eq 0)) { Write-Warning "DCO validation - nothing to validate!" return }