GitInfo: a source tree without its own git history builds, reporting commit "unknown"
The commit is already re-stamped on every build (JFJochGitInfo runs GitInfoStamp.cmake with cmake -P; configure_file rewrites GitInfo.cpp only when the value changed). What was missing is the case with no git: a downloaded tarball left the SHA empty, and one unpacked inside some other repository would have reported that repository's HEAD. The stamp now asks git only when the source directory is itself the top of a work tree, and otherwise records commit "unknown" beside the version from VERSION. The reflection files' git description drops its trailing date when there is none. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVmAWnzCmRKAXVUCdc4iNi
This commit is contained in:
@@ -110,9 +110,10 @@ std::string IsoDate(const std::string ×tamp) {
|
||||
return timestamp.substr(0, 10);
|
||||
}
|
||||
|
||||
// The commit this build was made from, with its date; empty when the build does not know it.
|
||||
// The commit this build was made from, with its date where the build knows it ("unknown" for a source
|
||||
// tree without git history).
|
||||
std::string GitDescription() {
|
||||
return jfjoch_git_sha1().empty() ? std::string() : jfjoch_git_sha1() + " " + jfjoch_git_date();
|
||||
return jfjoch_git_date().empty() ? jfjoch_git_sha1() : jfjoch_git_sha1() + " " + jfjoch_git_date();
|
||||
}
|
||||
|
||||
// The MTZ HISTORY records saying where a file came from, after the one naming the program: the
|
||||
@@ -284,7 +285,7 @@ void WriteMmcifReflections(const std::vector<MergedReflection> &reflections,
|
||||
// Rugnux integrated the images (data reduction) and scaled and merged them (data scaling), the
|
||||
// two rows the wwPDB asks a data-processing program to be named under; the description is the
|
||||
// commit the build was made from.
|
||||
const std::string software_description = CifStr(GitDescription().empty() ? "" : "git " + GitDescription());
|
||||
const std::string software_description = CifStr("git " + GitDescription());
|
||||
out << "loop_\n";
|
||||
out << "_software.pdbx_ordinal\n";
|
||||
out << "_software.name\n";
|
||||
|
||||
Reference in New Issue
Block a user