Skip to content

Commit

Permalink
Remove Git-related information in About Mudlet (Mudlet#4568)
Browse files Browse the repository at this point in the history
* try to fix git sha

* try to fix commit sha

* try to fix CI git info

* env variables correction

* correct set of variables

* fix setting sha env

* try to fix git sha

* correct cmakefile errro

* fix qmake file as well

* fix qmake file

* make local copies of git hub variables

* try to correct appveyor builds

* try to correct windows appveyor builds

* remove git commit info from about

* remove git info attempt from appveyor workflow

* remove accidental commit

Co-authored-by: Piotr Wilczynski <piotr.wilczynski@bisnode.com>
  • Loading branch information
Delwing and Piotr Wilczynski authored Jan 5, 2021
1 parent 1ce969e commit 055b31b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 70 deletions.
32 changes: 0 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,35 +180,3 @@ if(USE_UPDATER)
endif()

endif()

# Get the latest commit hash
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)

if(GIT_COMMIT_HASH)
target_compile_definitions(${PROJECT_NAME} PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
endif()

# Get the current working branch
execute_process(
COMMAND git describe --all --dirty --broken
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)

if(GIT_BRANCH)
STRING(REGEX REPLACE "heads/" "" GIT_BRANCH ${GIT_BRANCH})

if(GIT_BRANCH MATCHES ".*-dirty$")
STRING(REGEX REPLACE "-dirty$" " (modified)" GIT_BRANCH ${GIT_BRANCH})
endif()

if(GIT_BRANCH MATCHES ".*-broken")
STRING(REGEX REPLACE "-broken" " (broken)" GIT_BRANCH ${GIT_BRANCH})
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE "-DGIT_BRANCH=\"${GIT_BRANCH}\"")
endif()
13 changes: 0 additions & 13 deletions src/dlgAboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
// Debugging value to display ALL licences in the dialog
// #define DEBUG_SHOWALL

#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "?"
#endif

#ifndef GIT_BRANCH
#define GIT_BRANCH "?"
#endif

#include "dlgAboutDialog.h"

#include "mudlet.h"
Expand Down Expand Up @@ -1072,15 +1064,10 @@ void dlgAboutDialog::setSupportersTab(const QString& htmlHead)
}

QString dlgAboutDialog::createBuildInfo() const {

QString commitHash = !QByteArray(GIT_COMMIT_HASH).isEmpty() ? QStringLiteral(GIT_COMMIT_HASH) : QStringLiteral("?");
QString branch = !QByteArray(GIT_BRANCH).isEmpty() ? QStringLiteral(GIT_BRANCH) : QStringLiteral("?");
return QStringLiteral("<table border=\"0\" style=\"margin-bottom:18px; margin-left:36px; margin-right:36px;\" width=\"100%\" cellspacing=\"2\" cellpadding=\"0\">\n")
.append(QStringLiteral("<tr><td colspan=\"2\" style=\"font-weight: 800\">%1</td></tr>").arg(tr("Technical information:")))
.append(QStringLiteral("<tr><td style=\"padding-right: 10px;\">%1<td>%2</td></tr>").arg(tr("Version"), mudlet::self()->version))
.append(QStringLiteral("<tr><td style=\"padding-right: 10px;\">%1</td><td>%2</td></tr>").arg(tr("OS"), QSysInfo::prettyProductName()))
.append(QStringLiteral("<tr><td style=\"padding-right: 10px;\">%1</td><td>%2</td></tr>").arg(tr("CPU"), QSysInfo::currentCpuArchitecture()))
.append(QStringLiteral("<tr><td style=\"padding-right: 10px;\">%1</td><td>%2</td></tr>").arg(tr("Branch"), branch))
.append(QStringLiteral("<tr><td style=\"padding-right: 10px;\">%1</td><td>%2</td></tr>").arg(tr("Commit"), commitHash))
.append(QStringLiteral("</table>"));
}
25 changes: 0 additions & 25 deletions src/mudlet.pro
Original file line number Diff line number Diff line change
Expand Up @@ -104,31 +104,6 @@ isEmpty( BUILD ) {
BUILD = "-dev"
}

$$system(git --version, blob, GIT_STATUS)
isEqual(GIT_STATUS, 0) {
# Git command appeared to work - so get a description of the current
# repository state
GIT_DESCRIPTION=$$system(git describe --all --dirty --broken)
GIT_COMMITHASH=$$system(git rev-parse --short HEAD)
# remove the leading "head/"
GIT_DESCRIPTION=$$replace(GIT_DESCRIPTION, "heads/", "")
# Split it on hyphens
SPLIT_GIT_DESCRIPTION=$$split(GIT_DESCRIPTION, -)
# Get the last part so we can check if it is "broken" or "dirty"
LAST_GIT_DESCRIPTION=$$last(SPLIT_GIT_DESCRIPTION)
contains(LAST_GIT_DESCRIPTION, "broken" ) {
warning( "Main Git repository has a problem." )
GIT_DESCRIPTION=$$replace(GIT_DESCRIPTION, "-broken", " (broken)")
} else {
contains(LAST_GIT_DESCRIPTION, "dirty" ) {
GIT_DESCRIPTION=$$replace(GIT_DESCRIPTION, "-dirty", " (modified)")
}
}
!build_pass : message("Using a git description of: \"$${GIT_DESCRIPTION}\", Git SHA1 is: $${GIT_COMMITHASH}")
DEFINES += GIT_COMMIT_HASH=\\\"$${GIT_COMMITHASH}\\\"
DEFINES += GIT_BRANCH=\\\"\"$${GIT_DESCRIPTION}\"\\\"
}

# As the above also modifies the splash screen image (so developers get reminded
# what they are working with!) Packagers (e.g. for Linux distributions) will
# want to set the environmental variable WITH_VARIABLE_SPLASH_SCREEN to NO so
Expand Down

0 comments on commit 055b31b

Please sign in to comment.