diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-10-26 18:37:57 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-26 20:44:02 +0200 |
commit | 6852c3b039e5fb5b2f0330cb097f43af4f7f1ea2 (patch) | |
tree | 3deb05f3bdead52666c4dc77bff8755977a1897e /core | |
parent | 1be44351757ba453675cee6bf318442dbf5e3803 (diff) | |
download | subsurface-6852c3b039e5fb5b2f0330cb097f43af4f7f1ea2.tar.gz |
git save: create a better commit message for initial commit
When we create an empty repo we should simply state that in the commit message.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/save-git.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/save-git.c b/core/save-git.c index 436335a51..5ff67ddea 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -1070,12 +1070,14 @@ static int get_authorship(git_repository *repo, git_signature **authorp) return git_signature_now(authorp, user.name, user.email); } -static void create_commit_message(struct membuffer *msg) +static void create_commit_message(struct membuffer *msg, bool create_empty) { int nr = dive_table.nr; struct dive *dive = get_dive(nr-1); - if (dive) { + if (create_empty) { + put_string(msg, "Initial commit to create empty repo.\n\n"); + } else if (dive) { dive_trip_t *trip = dive->divetrip; const char *location = get_dive_location(dive) ? : "no location"; struct divecomputer *dc = &dive->dc; @@ -1153,7 +1155,7 @@ static int create_new_commit(git_repository *repo, const char *remote, const cha } else { struct membuffer commit_msg = { 0 }; - create_commit_message(&commit_msg); + create_commit_message(&commit_msg, create_empty); if (git_commit_create_v(&commit_id, repo, NULL, author, author, NULL, mb_cstring(&commit_msg), tree, parent != NULL, parent)) return report_error("Git commit create failed (%s)", strerror(errno)); free_buffer(&commit_msg); |