From 533df873b435da0ec6ed293faab217d5610876cc Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Tue, 25 Apr 2017 22:35:40 -0300 Subject: [PATCH] Allow arbitrary branch names for non-detached HEADs Fixes https://github.com/kzu/GitInfo/issues/27, yet it's more flexible than https://github.com/kzu/GitInfo/pull/34/files. --- src/GitInfo/build/GitInfo.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitInfo/build/GitInfo.targets b/src/GitInfo/build/GitInfo.targets index 61d8957..c3cc43c 100644 --- a/src/GitInfo/build/GitInfo.targets +++ b/src/GitInfo/build/GitInfo.targets @@ -288,7 +288,7 @@ <_GitHead>$([System.IO.Path]::Combine($(GitDir), 'HEAD')) <_GitHead>$([System.IO.Path]::GetFullPath($(_GitHead))) <_GitHead>$([System.IO.File]::ReadAllText('$(_GitHead)')) - $([System.Text.RegularExpressions.Regex]::Match($(_GitHead), '(?<=/)[^/]+$')) + $([System.Text.RegularExpressions.Regex]::Match($(_GitHead), '(?<=refs/heads/).+$')) $(GitBranch.Trim())