diff --git a/app/src/gambas3/.src/VersionControl/CVersionControlGit.class b/app/src/gambas3/.src/VersionControl/CVersionControlGit.class index 582c8453c..507cce7d0 100644 --- a/app/src/gambas3/.src/VersionControl/CVersionControlGit.class +++ b/app/src/gambas3/.src/VersionControl/CVersionControlGit.class @@ -72,18 +72,34 @@ Public Sub GetBranches(ByRef sCurrent As String) As String[] Dim sResult As String Dim sBranch As String Dim aBranches As New String[] + Dim bCurrent As Boolean - sResult = RunShell("git branch", True) + sResult = RunShell("git branch -a", True) For Each sBranch In Split(Trim(sResult), "\n") + sBranch = Trim(sBranch) If sBranch Begins "*" Then + sBranch = Trim(Mid$(sBranch, 2)) - sCurrent = sBranch + bCurrent = True + Else + bCurrent = False Endif - aBranches.Add(sBranch) + + If sBranch Begins "remotes/origin/" Then + sBranch = Mid$(sBranch, 16) + If InStr(sBranch, " -> ") Then Continue + Endif + + If bCurrent Then sCurrent = sBranch + + If Not aBranches.Exist(sBranch) Then aBranches.Add(sBranch) + Next + aBranches.Sort(gb.Natural) + Return aBranches End @@ -181,6 +197,8 @@ Public Sub Update() As Integer aEnv = VersionControl.LANG_ENV.Copy() aEnv.Add("PWD=" & Project.Dir) + VersionControl.Run(["git", "remote", "update", "origin", "--prune"], True, True, aEnv) + Return VersionControl.Run(["git", "pull", "-q"], True, True, aEnv) End