Commit cf64a98 1 parent f3f230f commit cf64a98 Copy full SHA for cf64a98
File tree 1 file changed +4
-8
lines changed
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,13 @@ let isGitVersionHigherOrEqual referenceVersion =
35
35
/// Gets the git branch name
36
36
let getBranchName repositoryDir =
37
37
try
38
- let ok , msg , errors = runGitCommand repositoryDir " status"
38
+ let ok , msg , errors = runGitCommand repositoryDir " status -s -b "
39
39
let s = msg |> Seq.head
40
-
41
- let mutable replaceBranchString = " On branch "
42
- let mutable replaceNoBranchString = " Not currently on any branch."
40
+
41
+ let replaceNoBranchString = " ## HEAD ("
43
42
let noBranch = " NoBranch"
44
43
45
- if isGitVersionHigherOrEqual " 1.9" then replaceNoBranchString <- " HEAD detached"
46
- if not <| isGitVersionHigherOrEqual " 1.9" then replaceBranchString <- " # " + replaceBranchString
47
-
48
- if startsWith replaceNoBranchString s then noBranch else s.Replace( replaceBranchString, " " )
44
+ if startsWith replaceNoBranchString s then noBranch else s.Substring( 3 )
49
45
with _ when ( repositoryDir = " " || repositoryDir = " ." ) && buildServer = TeamFoundation ->
50
46
match environVarOrNone " BUILD_SOURCEBRANCHNAME" with
51
47
| None -> reraise()
You can’t perform that action at this time.
0 commit comments