From: Junio C Hamano <gitster@pobox.com>
To: "Pat Notz" <patnotz@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCHv6 3/6] commit: --fixup option for use with rebase --autosquash
Date: Wed, 27 Oct 2010 15:35:50 -0700 [thread overview]
Message-ID: <7vpquvb6wp.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1287689637-95301-4-git-send-email-patnotz@gmail.com
"Pat Notz" <patnotz@gmail.com> writes:
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 5fa24f5..c82108c 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -586,6 +588,15 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
> strbuf_add(&sb, buffer + 2, strlen(buffer + 2));
> hook_arg1 = "commit";
> hook_arg2 = use_message;
> + } else if (fixup_message) {
> + struct pretty_print_context ctx = {0};
> + struct commit *commit;
> + const char *out_enc;
> + commit = lookup_commit_reference_by_name(fixup_message);
> + out_enc = get_commit_output_encoding();
> + format_commit_message(commit, "fixup! %s\n\n",
> + &sb, &ctx, out_enc);
As your lookup_commit_reference_by_name() expects the caller to check for
errors, you should do something similar to what you do in your
"use_message" codepath in your [PATCH 1/6].
if (use_message) {
const char *out_enc;
struct commit *commit;
commit = lookup_commit_reference_by_name(use_message);
if (!commit)
die("could not lookup commit %s", use_message);
out_enc = get_commit_output_encoding();
use_message_buffer = logmsg_reencode(commit, out_enc);
next prev parent reply other threads:[~2010-10-27 22:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 19:33 [PATCHv6 0/6] Add commit message options for rebase --autosquash Pat Notz
2010-10-21 19:33 ` [PATCHv6 1/6] commit: helper methods to reduce redundant blocks of code Pat Notz
2010-10-21 19:33 ` [PATCHv6 2/6] pretty.c: teach format_commit_message() to reencode the output Pat Notz
2010-10-27 22:35 ` Junio C Hamano
2010-10-21 19:33 ` [PATCHv6 3/6] commit: --fixup option for use with rebase --autosquash Pat Notz
2010-10-27 22:35 ` Junio C Hamano [this message]
2010-10-21 19:33 ` [PATCHv6 4/6] add tests of commit --fixup Pat Notz
2010-10-27 22:35 ` Junio C Hamano
2010-10-21 19:33 ` [PATCHv6 5/6] commit: --squash option for use with rebase --autosquash Pat Notz
2010-10-27 22:35 ` Junio C Hamano
2010-10-21 19:33 ` [PATCHv6 6/6] add tests of commit --squash Pat Notz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vpquvb6wp.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=patnotz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).