File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,25 @@ $updateAssms = Convert-String $updateAssemblyInfo Boolean
25
25
26
26
$loc = $ ($env: BUILD_SOURCESDIRECTORY )
27
27
$branch = $ ($env: BUILD_SOURCEBRANCH )
28
+ $commitId = $ ($env: BUILD_SOURCEVERSION )
29
+
30
+ $localBranch = $branch.Trim ().Replace(" refs/heads/" , " " )
31
+
32
+ Set-Location $loc
33
+
34
+ # VSO checks out the commit as a detached HEAD
35
+ # loop through and checkout all branches and the one we want
36
+ # then reset hard to get to the desired commit id
37
+ foreach ($remoteBranch in . git branch - r) {
38
+ . git checkout $remoteBranch.Trim ().Replace(" origin/" , " " ) 2>&1 | write-host
39
+
40
+ }
41
+ . git checkout $localBranch 2>&1 | write-host
42
+ . git reset -- hard $commitId 2>&1 | write-host
28
43
29
44
# Call GitVersion.exe
30
45
$gvPath = Get-PathToGitVersionExe
31
46
Write-Output " Path to GitVersion.exe = $gvPath "
32
- Invoke-Tool - Path $gvPath - Arguments " `" $loc `" /output buildserver /nofetch /b $branch / updateAssemblyInfo $updateAssms $additionalArguments "
47
+ Invoke-Tool - Path $gvPath - Arguments " `" $loc `" /output buildserver /nofetch /updateAssemblyInfo $updateAssms $additionalArguments "
33
48
34
49
You can’t perform that action at this time.
0 commit comments