[Gambas-user] New colored version display fails with older git versions

bb adamnt42 at gmail.com
Fri Nov 26 05:36:36 CET 2021


The IDE CVersionControlGit class uses the following to try and obtain
the currently active branch of the project:
Public Sub GetCurrentBranch() As String
  Return Trim(RunShell("git branch --show-current"))End

Unfortunately, the --show-current option in git-branch is only
available in versions 2.22.0 and later. See 
https://github.com/laurent22/joplin/issues/1695 for a "clue" resolving
this by using "git rev-parse --abbrev-ref HEAD".

Alternately, the following "should be" version independant but
microscopically slower:

  Return Trim(RunShell("git branch | grep \* | cut -d ' ' -f2"))

best regards
bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211126/3d4480e4/attachment.htm>


More information about the User mailing list