Skip to content

Commit

Permalink
Fix missing first character of local branch name
Browse files Browse the repository at this point in the history
The replacement string seems to be considered a regex because it's replacing more than it matches as a string only. So replace it with multiple replacements instead.
  • Loading branch information
kzu committed Feb 11, 2023
1 parent ec41874 commit 80c8019
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ThisAssembly.Git/ThisAssembly.Git.targets
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
<PropertyGroup Condition="'$(RepositoryBranch)' == '' and '$(RepositoryRoot)' != ''">
<!-- We may not be in CI at all. If we got a git repo root, we can directly read HEAD -->
<RepositoryHead>$(RepositoryRoot).git/HEAD</RepositoryHead>
<RepositoryBranch Condition="Exists($(RepositoryHead))">$([System.IO.File]::ReadAllText($(RepositoryHead)).TrimStart("ref: refs/heads/"))</RepositoryBranch>
<RepositoryBranch Condition="Exists($(RepositoryHead))">$([System.IO.File]::ReadAllText($(RepositoryHead)).Trim())</RepositoryBranch>
<RepositoryBranch Condition="$(RepositoryBranch) != ''">$(RepositoryBranch.TrimStart("ref:").Trim().TrimStart("refs").Trim("/").TrimStart("heads").Trim("/").Trim())</RepositoryBranch>
</PropertyGroup>

</Target>
Expand Down

0 comments on commit 80c8019

Please sign in to comment.