{"thread":{"id":"18350","subject":"Re: Generate version file by hooks","startedAt":"2009-03-17T15:42:01Z","lastAt":"2009-03-17T16:54:57Z","messageCount":3,"participants":["John Dlugosz","Björn Hendriks","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"108239","messageId":"450196A1AAAE4B42A00A8B27A59278E70A2AF280@EXCHANGE.trad.tradestation.com","threadId":"18350","inReplyTo":null,"subject":"Re: Generate version file by hooks","fromName":"John Dlugosz","fromEmail":"jdlugosz@tradestation.com","sentAt":"2009-03-17T15:42:01Z","receivedAt":"2009-03-17T15:42:01Z","isPatch":false,"sender":{"key":"jdlugosz@tradestation.com","avatar":null},"body":"=== Re: ===\nI'd like to put the SHA1 of the current commit into a source file so\nthat my \nprogram can further process it -- put it into a log file for example.\n=== end ===\n\nIsn't that what the existing file HEAD is for?  Possibly with a level of\nindirection.  So use \n\tgit rev-parse HEAD\nany time you need that SHA1 value.  The HEAD is always updated, since\nthat _is_ what defines the \"current\" commit.\n\n--John\n(please excuse the footer; it's not my idea)\n\nTradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.\n  If you received this in error, please contact the sender and delete the material from any computer.\n"},{"id":"108257","messageId":"200903171740.26575.bjoern01@nurfuerspam.de","threadId":"18350","inReplyTo":"450196A1AAAE4B42A00A8B27A59278E70A2AF280@EXCHANGE.trad.tradestation.com","subject":"Re: Generate version file by hooks","fromName":"Björn Hendriks","fromEmail":"bjoern01@nurfuerspam.de","sentAt":"2009-03-17T16:40:26Z","receivedAt":"2009-03-17T16:40:26Z","isPatch":false,"sender":{"key":"bjoern01@nurfuerspam.de","avatar":null},"body":"\nHi John, hi Santi,\n\nthanks for your help.\n\nOn Dienstag 17 März 2009 16:42:01 John Dlugosz wrote:\n> Isn't that what the existing file HEAD is for?  Possibly with a level of\n> indirection.  So use\n> \tgit rev-parse HEAD\n> any time you need that SHA1 value.  The HEAD is always updated, since\n> that _is_ what defines the \"current\" commit.\n\nThat might be a good alternative to my call of git-log which I was not \nabsolutely sure if it works under all circumstances.\n\nIn fact my problem is not to find out the SHA1 of the last commit in a script \nbut to have that script called automatically each time git changes the \ncommit. My idea was to use the git hooks for that, but as I explained I \ncouldn't find hooks for all cases in which a commit changes.\n\nI need git to do that because my application is a Matlab-project which I \nnormally do not compile -- although there is a Matlab-compiler to get a \nstandalone application, but within the Matlab environment you don't need to \ncompile. It would be the same with my little bash-helper-scripts I manage \nalso with the great assistance of git.\n\nBut now -- as I think of it -- I might as well put a script call into the \nMatlab-code to get the last SHA1 and find a different solution for the rare \ncases in which I really compile the Matlab-code.\n\nThanks\nBjörn\n"},{"id":"108261","messageId":"49BFD5E1.60803@viscovery.net","threadId":"18350","inReplyTo":"200903171740.26575.bjoern01@nurfuerspam.de","subject":"Re: Generate version file by hooks","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-03-17T16:54:57Z","receivedAt":"2009-03-17T16:54:57Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Björn Hendriks schrieb:\n> In fact my problem is not to find out the SHA1 of the last commit in a script \n> but to have that script called automatically each time git changes the \n> commit. My idea was to use the git hooks for that, but as I explained I \n> couldn't find hooks for all cases in which a commit changes.\n\nIn fact there are so many situations where the current commit changes. You\nwon't find enough hooks to catch all cases.\n\nYou better modify your build system to look for the current commit when it\nis needed. That is *much* safer.\n\n-- Hannes\n"}]}