diff options
| author | Jiang Xin <worldhello.net@gmail.com> | 2023-08-16 07:24:56 +0800 |
|---|---|---|
| committer | Jiang Xin <worldhello.net@gmail.com> | 2023-08-16 07:24:56 +0800 |
| commit | 62a26b36bd9bf76feb6940e2bee732bd62b429f8 (patch) | |
| tree | 3500be70c7d872566578e3fa324f1a8d1fe796e7 /sequencer.c | |
| parent | 450f2c9e3e461e4785643730f9c82eb9a64faddd (diff) | |
| parent | f1ed9d7dc0e49dc1a044941d821c9d2342313c26 (diff) | |
| download | git-62a26b36bd9bf76feb6940e2bee732bd62b429f8.tar.gz | |
Merge branch 'master' of github.com:git/git
* 'master' of github.com:git/git: (34 commits)
Git 2.42-rc2
t4053: avoid writing to unopened pipe
t4053: avoid race when killing background processes
Git 2.42-rc1
git maintenance: avoid console window in scheduled tasks on Windows
win32: add a helper to run `git.exe` without a foreground window
t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1
mv: handle lstat() failure correctly
parse-options: disallow negating OPTION_SET_INT 0
repack: free geometry struct
send-email: avoid creating more than one Term::ReadLine object
send-email: drop FakeTerm hack
t0040: declare non-tab indentation to be okay in this script
advice: handle "rebase" in error_resolve_conflict()
A few more topics before -rc1
mailmap: change primary address for Glen Choo
gitignore: ignore clangd .cache directory
docs: update when `git bisect visualize` uses `gitk`
compat/mingw: implement a native locate_in_PATH()
run-command: conditionally define locate_in_PATH()
...
Diffstat (limited to 'sequencer.c')
| -rw-r--r-- | sequencer.c | 26 |
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; } } |
