All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: VenomVendor <info@venomvendor.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Phillip Wood <phillip.wood@dunelm.org.uk>,
	git@vger.kernel.org
Subject: [PATCH 2/3] am: fix broken email with --committer-date-is-author-date
Date: Fri, 23 Oct 2020 03:09:39 -0400	[thread overview]
Message-ID: <20201023070939.GB2913115@coredump.intra.peff.net> (raw)
In-Reply-To: <20201023070747.GA2198273@coredump.intra.peff.net>

Commit e8cbe2118a (am: stop exporting GIT_COMMITTER_DATE, 2020-08-17)
rewrote the code for setting the committer date to use fmt_ident(),
rather than setting an environment variable and letting commit_tree()
handle it. But it introduced two bugs:

  - we use the author email string instead of the committer email

  - when parsing the committer ident, we used the wrong variable to
    compute the length of the email, resulting in it always being a
    zero-length string

This commit fixes both, which causes our test of this option via the
rebase "apply" backend to now succeed.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/am.c                   | 4 ++--
 t/t3436-rebase-more-options.sh | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/am.c b/builtin/am.c
index 2c7673f74e..4949535a7f 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -161,7 +161,7 @@ static void am_state_init(struct am_state *state)
 	state->committer_name =
 		xmemdupz(id.name_begin, id.name_end - id.name_begin);
 	state->committer_email =
-		xmemdupz(id.mail_begin, id.mail_end - id.mail_end);
+		xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
 }
 
 /**
@@ -1595,7 +1595,7 @@ static void do_commit(const struct am_state *state)
 
 	if (state->committer_date_is_author_date)
 		committer = fmt_ident(state->committer_name,
-				      state->author_email, WANT_COMMITTER_IDENT,
+				      state->committer_email, WANT_COMMITTER_IDENT,
 				      state->ignore_date ? NULL
 							 : state->author_date,
 				      IDENT_STRICT);
diff --git a/t/t3436-rebase-more-options.sh b/t/t3436-rebase-more-options.sh
index 6f2f49717b..3fda2235bd 100755
--- a/t/t3436-rebase-more-options.sh
+++ b/t/t3436-rebase-more-options.sh
@@ -70,7 +70,7 @@ test_ctime_is_atime () {
 	test_cmp authortime committertime
 }
 
-test_expect_failure '--committer-date-is-author-date works with apply backend' '
+test_expect_success '--committer-date-is-author-date works with apply backend' '
 	GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
 	git rebase --apply --committer-date-is-author-date HEAD^ &&
 	test_ctime_is_atime -1
-- 
2.29.0.583.g8e3ac41d8f


  parent reply	other threads:[~2020-10-23  7:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23  5:48 committer-date-is-author-date flag removes email in "Commit" VenomVendor
2020-10-23  7:07 ` Jeff King
2020-10-23  7:08   ` [PATCH 1/3] t3436: check --committer-date-is-author-date result more carefully Jeff King
2020-10-23 10:10     ` Phillip Wood
2020-10-23  7:09   ` Jeff King [this message]
2020-10-23  7:26     ` [PATCH 4/3] am, sequencer: stop parsing our own committer ident Jeff King
2020-10-23  7:45       ` Jeff King
2020-10-23 17:29         ` Taylor Blau
2020-10-26 16:25         ` Johannes Schindelin
2020-10-27  7:23           ` Jeff King
2020-10-23 14:06       ` Phillip Wood
2020-10-26 17:12       ` Junio C Hamano
2020-10-27  7:24         ` Jeff King
2020-10-23  7:10   ` [PATCH 3/3] rebase: fix broken email with --committer-date-is-author-date Jeff King
2020-10-23 15:23   ` committer-date-is-author-date flag removes email in "Commit" Junio C Hamano
2020-10-23 17:32     ` Phillip Wood
2020-10-23 17:59       ` Junio C Hamano

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=20201023070939.GB2913115@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=info@venomvendor.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.