From d5d830eac07311e3a920acabd8b94fd3d21d1db1 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 17 Feb 2018 12:15:26 +0100 Subject: Cleanup: Save hash from filename-to-hash map to git repository This unifies behavior of XML & git saving. Now, in both cases, the picture hash is extracted from the filename-to-hash map instead of using the picture structure. This seems more robust, because the picture structure is not necessarily updated by learnHash(). The latter may operate on a copy of the picture structure. Signed-off-by: Berthold Stoeger --- core/save-git.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/save-git.c b/core/save-git.c index a00aeed94..1c68e9652 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -604,12 +604,15 @@ static int save_one_picture(git_repository *repo, struct dir *dir, struct pictur int offset = pic->offset.seconds; struct membuffer buf = { 0 }; char sign = '+'; + char *hash; unsigned h; int error; show_utf8(&buf, "filename ", pic->filename, "\n"); show_gps(&buf, pic->latitude, pic->longitude); - show_utf8(&buf, "hash ", pic->hash, "\n"); + hash = hashstring(pic->filename); + show_utf8(&buf, "hash ", hash, "\n"); + free(hash); /* Picture loading will load even negative offsets.. */ if (offset < 0) { -- cgit v1.2.3-70-g09d2