From 257f074e5ad5389d8468953281bd69224ae56dbf Mon Sep 17 00:00:00 2001 From: RobinTF <83676088+RobinTF@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:22:20 +0100 Subject: [PATCH] Don't store complete hash This change is technically not backwards compatible, it will print long hashes when using old indices --- src/CompilationInfo.h | 4 +--- src/index/IndexImpl.cpp | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/CompilationInfo.h b/src/CompilationInfo.h index 91d8147f4c..4f3855d56a 100644 --- a/src/CompilationInfo.h +++ b/src/CompilationInfo.h @@ -8,9 +8,7 @@ #pragma once #include namespace qlever::version { -// The git hash of the commit that was used to QLever. -extern const std::string_view GitHash; -// Short version of GitHash +// Short version of the hash of the commit that was used to QLever. extern const std::string_view GitShortHash; // The date and time at which QLever was compiled. extern const std::string_view DatetimeOfCompilation; diff --git a/src/index/IndexImpl.cpp b/src/index/IndexImpl.cpp index 5372cbaf59..4653b43e4a 100644 --- a/src/index/IndexImpl.cpp +++ b/src/index/IndexImpl.cpp @@ -884,7 +884,7 @@ void IndexImpl::setPrefixCompression(bool compressed) { void IndexImpl::writeConfiguration() const { // Copy the configuration and add the current commit hash. auto configuration = configurationJson_; - configuration["git-hash"] = qlever::version::GitHash; + configuration["git-hash"] = qlever::version::GitShortHash; configuration["index-format-version"] = qlever::indexFormatVersion; auto f = ad_utility::makeOfstream(onDiskBase_ + CONFIGURATION_FILE); f << configuration; @@ -896,8 +896,7 @@ void IndexImpl::readConfiguration() { f >> configurationJson_; if (configurationJson_.find("git-hash") != configurationJson_.end()) { LOG(INFO) << "The git hash used to build this index was " - << configurationJson_["git-hash"].get().substr( - 0, 6) + << configurationJson_["git-hash"].get() << std::endl; } else { LOG(INFO) << "The index was built before git commit hashes were stored in "