From 8ce4e10ccb98558886ef4ead4554f44345acd603 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 5 Mar 2020 08:58:20 -0800 Subject: cloud storage: add list of changes made to commit messages This should make it easier to figure out what operations lead to the commit that is written to git. Signed-off-by: Dirk Hohndel --- core/save-git.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/save-git.c b/core/save-git.c index 4f6110eb1..daeae23a3 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -1044,9 +1044,12 @@ static void create_commit_message(struct membuffer *msg, bool create_empty) { int nr = dive_table.nr; struct dive *dive = get_dive(nr-1); + char* changes_made = get_changes_made(); if (create_empty) { put_string(msg, "Initial commit to create empty repo.\n\n"); + } else if (!empty_string(changes_made)) { + put_format(msg, "Changes made: \n\n%s\n", changes_made); } else if (dive) { dive_trip_t *trip = dive->divetrip; const char *location = get_dive_location(dive) ? : "no location"; @@ -1071,6 +1074,9 @@ static void create_commit_message(struct membuffer *msg, bool create_empty) const char *user_agent = subsurface_user_agent(); put_format(msg, "Created by %s\n", user_agent); free((void *)user_agent); + free(changes_made); + if (verbose) + fprintf(stderr, "Commit message:\n\n%s\n", mb_cstring(msg)); } static int create_new_commit(git_repository *repo, const char *remote, const char *branch, git_oid *tree_id, bool create_empty) -- cgit v1.2.3-70-g09d2