summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-15 01:57:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-04-15 01:57:48 (GMT)
commitea7fefbd7b25deb7c0b4da56d95d67116edded48 (patch)
treef77f4d58e74102c4dffa8b37e176ff210c681e3b /builtin/commit.c
parent8cad7fcfbcba99fa1541bf6ca1f2ad83767fc348 (diff)
parentb64c1e0718f4a54d75b8faf0421471faa531af68 (diff)
downloadgit-ea7fefbd7b25deb7c0b4da56d95d67116edded48.zip
git-ea7fefbd7b25deb7c0b4da56d95d67116edded48.tar.gz
git-ea7fefbd7b25deb7c0b4da56d95d67116edded48.tar.bz2
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/commit.c')
-rw-r--r--builtin/commit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index b3bd2d4..c733ec9 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"));