holgerBerger / hpc-workspace

Automatically exported from code.google.com/p/hpc-workspace
GNU General Public License v3.0
18 stars 13 forks source link

fix empty version number output by using the version option at the release #39

Closed gerd closed 4 years ago

gerd commented 4 years ago

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.

mflehmig commented 4 years ago

Great!

holgerBerger commented 4 years ago

would it not make more sense to show the tag and not the hash? but I would be ok with the hash as well.

gerd commented 4 years ago

I think for checking out the hash is needed.

I think perfect would be to get this output:

I don't know if this code would work: if (opt.count("version")) {

ifdef IS_GIT_REPOSITORY

    cout << "workspace build from git commit hash " << GIT_COMMIT_HASH
         << " on top of release " << WS_VERSION << endl;

else

    cout << "workspace version " << WS_VERSION << endl;

endif

    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.

gerd commented 4 years ago

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: