Skip to content

Commit

Permalink
Change git branch detection in git version script again
Browse files Browse the repository at this point in the history
Didn't work for azure pipelines style checkout

Work for #196
[release]
  • Loading branch information
atruskie committed Apr 6, 2020
1 parent 8f2315c commit 1784737
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/git_version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ $self_contained = if ($self_contained -eq 'true') { 'true' } else { 'false' }

$commit_hash = git show -s --format="%H"

$git_log = git log -n 1 --pretty=%d HEAD
Write-output "git log output: $git_log"
$branch = ($git_log | Select-String "-> ([\w-]+)").Matches[0].Groups[1].Value
$rev_head = git rev-parse HEAD
$branches = git for-each-ref --format='%(objectname) %(refname:short)' refs/heads | Where-Object { $_.StartsWith($rev_head) } | ForEach-Object { ($_ -split ' ')[1] }
Write-output "git brnaches: $($branches -join ' ')"
$branch = $branches -join ' '
Write-output "branch: $branch"

$describe = git describe --dirty --abbrev --long --always
Expand Down

0 comments on commit 1784737

Please sign in to comment.