git - What Branch Am I On? lazarus / 9-Editor ---------------------------------------------------------------------- del · 2019-10-03 23:55 OK - first of all I do all my git stuff from the command line, bash, powershell, etc. I prefer it that way. But when I'm using the IDE (Visual Studio) it's nice to be able to see what local branch I'm on. A little bit of text in a status bar that says "git master" or "git working", etc. Just some coolness to make sure that I'm not directly modifying the master (like I did yesterday). I'm not looking for Lazarus git support - I don't even use VS's git support. I just like the little thingy that tells you what branch you're on. ---------------------------------------------------------------------- JuhaManninen · 2019-10-04 05:38 Where should it show in the IDE? With command line you can check it with "git branch". ---------------------------------------------------------------------- zamronypj · 2019-10-04 05:58 I use https://github.com/jimeh/git-aware-prompt If current directory is git repository, it shows current branch on shell prompt so I immediately aware active branch without having to run 'git branch' or 'git status` command. VS Code shows this information at bottom left of status bar. ---------------------------------------------------------------------- mtournay · 2019-10-04 06:41 Quote from: JuhaManninen on October 04, 2019, 07:38:21 amWhere should it show in the IDE? in the title of main window, after compilation mode ? I use VSCode for web dev, git integration is good. I believe that one day I can have the same in Lazarus IDE. just a simple window with modified files, the ability to 'add' them individualy, input commit message and commit... ---------------------------------------------------------------------- avra · 2019-10-04 07:20 Implementing such request in a cross platform way would not be easy, so I doubt that it would ever get into Lazarus. However, one can create a custom IDE plugin adding a panel, status line, or menu item showing the needed info for one or all major platforms. On the other hand, modifying VCS git/svn/mercurial/bazaar IDE plugin to show relevant info in existing top menu sounds both space saving and easy to implement (although Windows only). https://wiki.freepascal.org/Extending_the_IDE https://gitlab.com/ccrdude/lazvcshelper ---------------------------------------------------------------------- mtournay · 2019-10-04 07:40 Quote from: avra on October 04, 2019, 09:20:57 amhttps://gitlab.com/ccrdude/lazvcshelper Thanks avra, didn't know this addon (not in OPM, that's why !) Quote from: avra on October 04, 2019, 09:20:57 amImplementing such request in a cross platform way would not be easy, so I doubt that it would ever get into Lazarus. No sure it was very difficult, vscode and other ide need git cmdline to be installed, and call the executable. git has special parameter (--porcelain) to give formatted result Quote from: avra on October 04, 2019, 09:20:57 amHowever, one can create a custom IDE plugin adding a panel, status line, or menu item showing the needed info for one or all major platforms Quote from: avra on October 04, 2019, 09:20:57 amOn the other hand, modifying VCS git/svn/mercurial/bazaar IDE plugin to show relevant info in existing top menu sounds both space saving and easy to implement (although Windows only). https://wiki.freepascal.org/Extending_the_IDE I've seen lazvcshelper menu... This only miss a window plugin with directory survey to show modified files ! Maybe one day if dev (Patrick Kolla-ten Venne) have enough time (and desire)... ---------------------------------------------------------------------- del · 2019-10-04 11:03 Quote from: JuhaManninen on October 04, 2019, 07:38:21 amWhere should it show in the IDE? With command line you can check it with "git branch". Where it does on Visual Studio - in the lower right corner. Like on a status bar with a little branch symbol. I already knew the command line trick - I was hoping for the indicator on the IDE. Something you can give a quick glance to before you save your edits. It's really studly on Visual Studio and would be a neat thing to have on Lazarus IMHO. Maybe I'll cook something up. Not looking for Lazarus to acquire and integrate any actual functionality - just leverage the git utility that's already installed. IIRC Geany has a git plugin, but I guessing it just talks to the git utility already installed onboard the system. ---------------------------------------------------------------------- avra · 2019-10-04 12:02 Quote from: del on October 04, 2019, 01:03:41 pmI was hoping for the indicator on the IDE. Something you can give a quick glance to before you save your edits.I do not see anything stopping you from adding such a feature into https://gitlab.com/ccrdude/lazvcshelper/blob/master/source/VCSHelper.M enu.pas and for example showing 'Git:NameOfCurrentProjectBranch' instead of just 'Git' title for the menu. There are many ways to skin the cat, but using project open event and some periodic timer, or even better a thread using QueueAsyncCall() to update menu title do not sound that hard. ---------------------------------------------------------------------- del · 2019-10-04 13:17 Quote from: avra on October 04, 2019, 02:02:44 pmI do not see anything stopping you from adding such a feature into https://gitlab.com/ccrdude/lazvcshelper/blob/master/source/VCSHelper.M enu.pas and for example showing 'Git:NameOfCurrentProjectBranch' instead of just 'Git' title for the menu. There are many ways to skin the cat, but using project open event and some periodic timer, or even better a thread using QueueAsyncCall() to update menu title do not sound that hard. OK - I've never tweaked an IDE before - but that's the beauty of having an open source IDE (and a fast compiler). I think I'll have to get my feet wet. Thanks! ---------------------------------------------------------------------- mtournay · 2019-10-04 15:50 @del : actually VCSHelper is only windows (it use tortoise SVN/GIT) ---------------------------------------------------------------------- del · 2019-10-04 16:15 Quote from: mtournay on October 04, 2019, 05:50:49 pm@del : actually VCSHelper is only windows (it use tortoise SVN/GIT) OK - cool. I'm using Lazarus on Linux. Basically what I'm looking at crudely described (if I had to do this like this afternoon) would be a sys call to "git branch" and parse out the branch that had the "*" in front of it. Maybe that's the way to go. Sys calls aren't very sexy, but they do what they do. ---------------------------------------------------------------------- avra · 2019-10-05 12:09 Quote from: mtournay on October 04, 2019, 05:50:49 pm@del : actually VCSHelper is only windows (it use tortoise SVN/GIT)VCSHelper seams to use libgit2 which has linux version, and if that's what TortoiseGIT installs then maybe it's easier to go that way... ---------------------------------------------------------------------- thierrybo · 2021-09-09 20:36 Quote from: del on October 04, 2019, 01:03:41 pmQuote from: JuhaManninen on October 04, 2019, 07:38:21 amWhere should it show in the IDE? With command line you can check it with "git branch". Where it does on Visual Studio - in the lower right corner. Like on a status bar with a little branch symbol. I already knew the command line trick - I was hoping for the indicator on the IDE. Something you can give a quick glance to before you save your edits. It's really studly on Visual Studio and would be a neat thing to have on Lazarus IMHO. Maybe I'll cook something up. Not looking for Lazarus to acquire and integrate any actual functionality - just leverage the git utility that's already installed. IIRC Geany has a git plugin, but I guessing it just talks to the git utility already installed onboard the system. Sorry to dig up an old topic, but if you still want this, maybe it is time to request it for the upcoming LazGit package (not the same as the fake old 2014 's one) : https://www.patreon.com/posts/git-integration-47353869