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

@ -42,7 +42,6 @@ extern bool remote_repo_uptodate(const char *filename, struct git_info *info);
extern int sync_with_remote(struct git_info *);
extern int git_save_dives(struct git_info *, bool select_only);
extern int git_load_dives(struct git_info *, struct divelog *log);
extern const char *get_sha(git_repository *repo, const char *branch);
extern int do_git_save(struct git_info *, bool select_only, bool create_empty);
extern void cleanup_git_info(struct git_info *);
extern bool git_local_only;
@ -60,6 +59,7 @@ int get_authorship(git_repository *repo, git_signature **authorp);
#include <string>
extern std::string saved_git_id;
extern std::string get_sha(git_repository *repo, const char *branch);
#endif
#endif // GITACCESS_H