sequencer: use rebase_path_message()
Rather than constructing the path in a struct strbuf use the ready made function to get the path name instead. This was the last remaining use of the strbuf so remove it as well. As with the previous patch we now use a hard coded string rather than git_dir() when constructing the path. This is safe for the same reason (make_patch() is only called when rebasing) and is protected by the assertion added in the previous patch. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Sep 6, 2023 at 15:22 UTC
9f67899b41e5a95ce31af38c6b6d600433546d9e
1 file changed
+2
-5
sequencer.c
+2
-5
@@ -3484,7 +3484,6 @@ static int make_patch(struct repository *r,
3484
struct commit *commit,
3485
struct replay_opts *opts)
3486
{
3487
- struct strbuf buf = STRBUF_INIT;
3487
struct rev_info log_tree_opt;
3488
const char *subject;
3489
char hex[GIT_MAX_HEXSZ + 1];
@@ -3515,18 +3514,16 @@ static int make_patch(struct repository *r,
3514
fclose(log_tree_opt.diffopt.file);
3515
}
3516
3518
- strbuf_addf(&buf, "%s/message", get_dir(opts));
3519
- if (!file_exists(buf.buf)) {
3517
+ if (!file_exists(rebase_path_message())) {
3518
const char *encoding = get_commit_output_encoding();
3519
const char *commit_buffer = repo_logmsg_reencode(r,
3520
commit, NULL,
3521
encoding);
3522
find_commit_subject(commit_buffer, &subject);
3525
- res |= write_message(subject, strlen(subject), buf.buf, 1);
3523
+ res |= write_message(subject, strlen(subject), rebase_path_message(), 1);
3524
repo_unuse_commit_buffer(r, commit,
3525
commit_buffer);
3526
}
3529
- strbuf_release(&buf);
3527
release_revisions(&log_tree_opt);
3528
3529
return res;