On 3/19/21 8:19 PM, Paul A Bristow via Boost wrote:
I've been considering adding commit hash info to some documentation made using the Quickbook/Boostbook/Docbook/b2/bjam toolchain
Using git command line git log or ls-remote I can show the necessary hex digit string:
commit 5609fa86e37e1b0eae6466065ba6c8eb3ac0ab2f (HEAD -> refactor1)
(It would be useful to have the local commit (rather than remote) so that the generated documentation including this has can be pushed up to remote).
Paul@hetpD MINGW64 /i/boost/libs/quan/doc (refactor1) $ git log -n1 HEAD > commit.txt
That contains
commit 5609fa86e37e1b0eae6466065ba6c8eb3ac0ab2f Author: pabristow
Date: Fri Mar 19 15:46:45 2021 +0000 Generated super new version.
So this gets this info into a file, but I have yet to see how to get this into the Quickbook or ? during the b2 build.
I note that the Boost documentation headers provide this information in the form a link like displayed as d57d645009 with contents
https://github.com/boostorg/boost/commit/d57d6450098300343c6fe3a221297915244...
but I don't know how this works.
Has anyone done anything like this?
Suggestions most welcome.
If you're trying to put something line "Generated from commit <SHA1>" in the docs, then I don't think you can do this with git, as its commit id depends on the contents. That is, you could do this, but you would have to make a separate commit adding that line, and it would refer to a past commit.