Recent

Author Topic: git - What Branch Am I On?  (Read 3642 times)

del

  • Full Member
  • ***
  • Posts: 230
git - What Branch Am I On?
« on: October 04, 2019, 01:55:11 am »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3998
  • I like bugs.
Re: git - What Branch Am I On?
« Reply #1 on: October 04, 2019, 07:38:21 am »
Where should it show in the IDE?
With command line you can check it with "git branch".
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

zamronypj

  • Full Member
  • ***
  • Posts: 131
    • Fano Framework, Free Pascal web application framework
Re: git - What Branch Am I On?
« Reply #2 on: October 04, 2019, 07:58:37 am »
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.
« Last Edit: October 04, 2019, 08:03:42 am by zamronypj »
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Apache module executes Pascal program like scripting language https://zamronypj.github.io/mod_pascal/
Github https://github.com/zamronypj

mtournay

  • Jr. Member
  • **
  • Posts: 62
Re: git - What Branch Am I On?
« Reply #3 on: October 04, 2019, 08:41:17 am »
Where 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...
laz 2.06 32b - fpc 3.04 32b - win10 64b

avra

  • Hero Member
  • *****
  • Posts: 2263
    • Additional info
Re: git - What Branch Am I On?
« Reply #4 on: October 04, 2019, 09:20:57 am »
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
« Last Edit: October 04, 2019, 09:22:40 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

mtournay

  • Jr. Member
  • **
  • Posts: 62
Re: git - What Branch Am I On?
« Reply #5 on: October 04, 2019, 09:40:31 am »
https://gitlab.com/ccrdude/lazvcshelper

Thanks avra, didn't know this addon (not in OPM, that's why !)

Implementing 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

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

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)...
laz 2.06 32b - fpc 3.04 32b - win10 64b

del

  • Full Member
  • ***
  • Posts: 230
Re: git - What Branch Am I On?
« Reply #6 on: October 04, 2019, 01:03:41 pm »
Where 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

  • Hero Member
  • *****
  • Posts: 2263
    • Additional info
Re: git - What Branch Am I On?
« Reply #7 on: October 04, 2019, 02:02:44 pm »
I 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.Menu.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.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

del

  • Full Member
  • ***
  • Posts: 230
Re: git - What Branch Am I On?
« Reply #8 on: October 04, 2019, 03:17:43 pm »
I do not see anything stopping you from adding such a feature into
https://gitlab.com/ccrdude/lazvcshelper/blob/master/source/VCSHelper.Menu.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

  • Jr. Member
  • **
  • Posts: 62
Re: git - What Branch Am I On?
« Reply #9 on: October 04, 2019, 05:50:49 pm »
@del : actually VCSHelper is only windows (it use tortoise SVN/GIT)
laz 2.06 32b - fpc 3.04 32b - win10 64b

del

  • Full Member
  • ***
  • Posts: 230
Re: git - What Branch Am I On?
« Reply #10 on: October 04, 2019, 06:15:45 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

  • Hero Member
  • *****
  • Posts: 2263
    • Additional info
Re: git - What Branch Am I On?
« Reply #11 on: October 05, 2019, 02:09:20 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...
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

thierrybo

  • Full Member
  • ***
  • Posts: 132
Re: git - What Branch Am I On?
« Reply #12 on: September 09, 2021, 10:36:06 pm »
Where 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

 

TinyPortal © 2005-2018