Closed gerd closed 4 years ago
Great!
would it not make more sense to show the tag and not the hash? but I would be ok with the hash as well.
I think for checking out the hash is needed.
I think perfect would be to get this output:
For the release $ ./bin/ws_allocate -V workspace version 1.0.0
For a build from git sources $ ./bin/ws_allocate -V workspace build from git commit hash 4c04243 on top of release 1.0.0
I don't know if this code would work: if (opt.count("version")) {
cout << "workspace build from git commit hash " << GIT_COMMIT_HASH
<< " on top of release " << WS_VERSION << endl;
cout << "workspace version " << WS_VERSION << endl;
exit(1);
May be it could be done in a second step. For the first release it would be fine that $ ./bin/ws_allocate -V workspace version 1.0.0 works.
P.S. I am sorry. This should only be a suggestion. What do you think if the output of the ws_allocate command would be:
For the release $ ./bin/ws_allocate -V workspace version 1.0.0
For a build from git sources $ ./bin/ws_allocate -V workspace build from git commit hash 4c04243 on top of release 1.0.0
The git commit hash is printed as version number. If the source is not a git repository then the version number output is empty. The current commit checks if the subdirectory '.git' exists and acts appropriate the two situations. The variable IS_GIT_REPOSITORY is set for further use that may be done in the future.