Skip to content

Commit 2a55509

Browse files
committed
Show only the first 8 characters of the revision
1 parent c243c11 commit 2a55509

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/global/internal/appinfo.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ AppInfo::AppInfo(QObject *parent) :
1313

1414
QString scratchcpp::AppInfo::revision() const
1515
{
16-
return git_CommitSHA1();
16+
QString rev = git_CommitSHA1();
17+
18+
if (rev.size() >= 8)
19+
return rev.first(8);
20+
21+
return "";
1722
}
1823

1924
int scratchcpp::AppInfo::buildYear() const

src/global/test/appinfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ using namespace scratchcpp::test;
1515
TEST(AppInfoTest, Revision)
1616
{
1717
AppInfo info;
18-
ASSERT_EQ(info.revision(), git_CommitSHA1());
18+
QString rev = git_CommitSHA1();
19+
ASSERT_GE(rev.size(), 8);
20+
ASSERT_EQ(info.revision(), rev.first(8));
1921
}
2022

2123
TEST(AppInfoTest, BuildYear)

0 commit comments

Comments
 (0)