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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-02-17 12:15:26 +01:00 committed by Dirk Hohndel
parent e880948d73
commit d5d830eac0

View file

@ -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) {