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>
This commit is contained in:
Dirk Hohndel 2020-03-05 08:58:20 -08:00
parent 160d2ab071
commit 8ce4e10ccb

View file

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