Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-08-10 02:18:16 +0300
committerJunio C Hamano <gitster@pobox.com>2023-08-10 02:18:16 +0300
commite8c53ff91282861d4efe5d807129a55e193e6451 (patch)
treeab211df1696719021339b621c31ad26ddd32585d /sequencer.c
parent8cdd5e713d7ba54b9d26ac997408bb745ab55088 (diff)
parent6ce7afe16384b741f1ee4c5f310fa4a9f66348ba (diff)
Merge branch 'pw/rebase-skip-commit-message-fix'
"git rebase -i" with a series of squash/fixup, when one of the steps stopped in conflicts and ended up getting skipped, did not handle the accumulated commit log messages, which has been corrected. * pw/rebase-skip-commit-message-fix: rebase --skip: fix commit message clean up when skipping squash
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sequencer.c b/sequencer.c
index adc9cfb4df..5e0c15a16b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -5048,19 +5048,31 @@ static int commit_staged_changes(struct repository *r,
* We need to update the squash message to skip
* the latest commit message.
*/
+ int res = 0;
struct commit *commit;
+ const char *msg;
const char *path = rebase_path_squash_msg();
const char *encoding = get_commit_output_encoding();
- if (parse_head(r, &commit) ||
- !(p = repo_logmsg_reencode(r, commit, NULL, encoding)) ||
- write_message(p, strlen(p), path, 0)) {
- repo_unuse_commit_buffer(r, commit, p);
- return error(_("could not write file: "
+ if (parse_head(r, &commit))
+ return error(_("could not parse HEAD"));
+
+ p = repo_logmsg_reencode(r, commit, NULL, encoding);
+ if (!p) {
+ res = error(_("could not parse commit %s"),
+ oid_to_hex(&commit->object.oid));
+ goto unuse_commit_buffer;
+ }
+ find_commit_subject(p, &msg);
+ if (write_message(msg, strlen(msg), path, 0)) {
+ res = error(_("could not write file: "
"'%s'"), path);
+ goto unuse_commit_buffer;
}
- repo_unuse_commit_buffer(r,
- commit, p);
+ unuse_commit_buffer:
+ repo_unuse_commit_buffer(r, commit, p);
+ if (res)
+ return res;
}
}