summaryrefslogtreecommitdiffstats
path: root/core/save-git.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-05 08:58:20 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-10 09:25:57 -0700
commit8ce4e10ccb98558886ef4ead4554f44345acd603 (patch)
tree7c6fede979e7c2d387d392d67f96e704b3d9ab85 /core/save-git.c
parent160d2ab07155d895991a5198c574fcf26c2e908f (diff)
downloadsubsurface-8ce4e10ccb98558886ef4ead4554f44345acd603.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'core/save-git.c')
-rw-r--r--core/save-git.c6
1 files changed, 6 insertions, 0 deletions
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)