Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » insert git head into code
insert git head into code [message #1496244] Tue, 02 December 2014 22:31 Go to next message
Alex Pabouctsidis is currently offline Alex PabouctsidisFriend
Messages: 1
Registered: December 2014
Junior Member
Hello all,

I'm currently working on an embedded project (ARM) using Eclipse CDT + GNU ARM Eclipse, and i am using git for all of my revision control.

I'm trying to find a way to extract the current git head information such as the commit id, date, author, branch, etc. which would then be hard coded into the project at compile time (such as a #define, structure, etc.). This in turn would then be used when creating crash/data logs on an external SD card.

After a fair amount of searching i wasn't able to find any indication whether or not this is possible.

Any help / advice would be very much appreciated!

Thanks,
Alex
Re: insert git head into code [message #1565695 is a reply to message #1496244] Thu, 15 January 2015 12:28 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
Using jgit command line [1] you can do something like

$ jgit show HEAD

If you want to do that from Java have a look at how jgit show command is implemented [2]

[1] https://www.eclipse.org/jgit/download/
[2] http://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java
Previous Topic:security-fix for CVE-2014-9390
Next Topic:"Replace with Index" and "Replace with HEAD" in Staging view do nothing
Goto Forum:
  


Current Time: Thu Mar 28 16:59:26 GMT 2024

Powered by FUDForum. Page generated in 0.02978 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top