diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-02-17 12:15:26 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-02-17 11:06:30 -0800 |
commit | d5d830eac07311e3a920acabd8b94fd3d21d1db1 (patch) | |
tree | 85d1438aa540c6638bfdaa5cc7387c16b503dee2 | |
parent | e880948d73ba06f7af7df7829ae82aeaab17786b (diff) | |
download | subsurface-d5d830eac07311e3a920acabd8b94fd3d21d1db1.tar.gz |
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>
-rw-r--r-- | core/save-git.c | 5 |
1 files changed, 4 insertions, 1 deletions
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) { |