summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-06 18:39:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-04-06 18:39:10 (GMT)
commita6822e4172a8fa889b10a7a363088d2a05932b9b (patch)
tree2ab9df60af3d64f241818db7c856df18768280aa /builtin
parent2c657edce704ec7e91dfc03de5d882b4327369f4 (diff)
parentb64c1e0718f4a54d75b8faf0421471faa531af68 (diff)
downloadgit-a6822e4172a8fa889b10a7a363088d2a05932b9b.zip
git-a6822e4172a8fa889b10a7a363088d2a05932b9b.tar.gz
git-a6822e4172a8fa889b10a7a363088d2a05932b9b.tar.bz2
Merge branch 'ss/commit-squash-msg'
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.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 109742e..98e1527 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -727,9 +727,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"));