diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-04-14 18:57:48 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-14 18:57:48 -0700 |
commit | ea7fefbd7b25deb7c0b4da56d95d67116edded48 (patch) | |
tree | f77f4d58e74102c4dffa8b37e176ff210c681e3b /builtin | |
parent | Merge branch 'jk/send-email-rtrim-mailrc-alias' into maint (diff) | |
parent | commit: do not lose SQUASH_MSG contents (diff) | |
download | tgif-ea7fefbd7b25deb7c0b4da56d95d67116edded48.tar.xz |
Merge branch 'ss/commit-squash-msg' into maint
When "git merge --squash" stopped due to conflict, the concluding
"git commit" failed to read in the SQUASH_MSG that shows the log
messages from all the squashed commits.
* ss/commit-squash-msg:
commit: do not lose SQUASH_MSG contents
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/commit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index b3bd2d4181..c733ec98b7 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -726,9 +726,18 @@ static int prepare_to_commit(const char *index_file, const char *prefix, &sb, &ctx); hook_arg1 = "message"; } else if (!stat(git_path_merge_msg(), &statbuf)) { + /* + * prepend SQUASH_MSG here if it exists and a + * "merge --squash" was originally performed + */ + if (!stat(git_path_squash_msg(), &statbuf)) { + if (strbuf_read_file(&sb, git_path_squash_msg(), 0) < 0) + die_errno(_("could not read SQUASH_MSG")); + hook_arg1 = "squash"; + } else + hook_arg1 = "merge"; if (strbuf_read_file(&sb, git_path_merge_msg(), 0) < 0) die_errno(_("could not read MERGE_MSG")); - hook_arg1 = "merge"; } else if (!stat(git_path_squash_msg(), &statbuf)) { if (strbuf_read_file(&sb, git_path_squash_msg(), 0) < 0) die_errno(_("could not read SQUASH_MSG")); |