diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-12-08 20:06:00 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-12-09 20:23:37 +0100 |
commit | 458776d704579528c999a70024dcce73329beee5 (patch) | |
tree | 80b03139d073889639007a495c574fca82c5719b /src/version.cc | |
parent | 8169f76a3b95f07fd84bdc4aed41deb87973fb9a (diff) |
Add git commit to the reported version with -v
When git is available, records the git commit in the dillo binary, so
dillo -v reports the version and the commit. Otherwise only the release
version is reported (as we do now).
The commit is *always* recomputed when "make" is called. This allows
switching branches, doing a dirty rebuild and still get the correct
commit with "dillo -v".
Using AC_INIT() doesn't update the commit when the source is already
configured.
Fixes: https://github.com/dillo-browser/dillo/issues/288
Diffstat (limited to 'src/version.cc')
-rw-r--r-- | src/version.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/version.cc b/src/version.cc index f118c202..44b894e5 100644 --- a/src/version.cc +++ b/src/version.cc @@ -18,6 +18,7 @@ */ #include "config.h" +#include "commit.h" #include "djpeg.h" #include "dpng.h" @@ -114,7 +115,13 @@ static void print_features() void a_Version_print_info(void) { - printf("Dillo version " VERSION "\n"); + const char *version = "v" VERSION; + +#ifdef GIT_COMMIT + version = GIT_COMMIT; +#endif + + printf("Dillo %s\n", version); print_libs(); print_features(); } |