core: make get_sha() return std::string

This was crazy: it returned a local static buffer, i.e. was
inherently non-reentrant.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-02-29 13:57:26 +01:00 committed by Michael Keller
parent 2f3d8d83f5
commit 2f4dbf1848
3 changed files with 7 additions and 7 deletions

View file

@ -269,9 +269,9 @@ extern "C" bool remote_repo_uptodate(const char *filename, struct git_info *info
std::string current_sha = saved_git_id;
if (is_git_repository(filename, info) && open_git_repository(info)) {
const char *sha = get_sha(info->repo, info->branch);
std::string sha = get_sha(info->repo, info->branch);
if (!sha.empty() && current_sha == sha) {
fprintf(stderr, "already have loaded SHA %s - don't load again\n", sha);
fprintf(stderr, "already have loaded SHA %s - don't load again\n", sha.c_str());
return true;
}
}