Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve version display #168

Merged
merged 2 commits into from
Dec 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion args.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ void parse_args(int argc, char* argv[])
if(strcmp(argv[i], "-v") == 0 ||
strcmp(argv[i], "version") == 0)
{
if(strcmp(GIT_BRANCH, "master") == 0)
char version[] = GIT_BRANCH;
// Check if version is of format vX.YYY or vXX.YYY
// '.' can never be part of a commit hash
if(version[2] == '.' || version[3] == '.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be more future-proof?

if(strstr(version, ".") != NULL)

printf("%s\n",GIT_VERSION);
else
printf("vDev-%s\n",GIT_HASH);
Expand Down
3 changes: 2 additions & 1 deletion log.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ void log_counter_info(void)
void log_FTL_version(void)
{
logg("FTL branch: %s", GIT_BRANCH);
logg("FTL hash: %s", GIT_VERSION);
logg("FTL version: %s", GIT_VERSION);
logg("FTL tag: %s", GIT_TAG);
logg("FTL date: %s", GIT_DATE);
logg("FTL user: %s", username);
}
3 changes: 2 additions & 1 deletion request.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,8 @@ void getVersion(int *sock)
{
char server_message[SOCKETBUFFERLEN];

if(strcmp(GIT_BRANCH, "master") == 0)
char version[] = GIT_BRANCH;
if(version[2] == '.' || version[3] == '.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other comment

sprintf(server_message,"version %s\ntag %s\nbranch %s\ndate %s\n", GIT_VERSION, GIT_TAG, GIT_BRANCH, GIT_DATE);
else
sprintf(server_message,"version vDev-%s\ntag %s\nbranch %s\ndate %s\n", GIT_HASH, GIT_TAG, GIT_BRANCH, GIT_DATE);
Expand Down