git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/5] sequencer.c: handle rfc2822 continuation lines correctly

From
Brandon Casey <drafnel@gmail.com>
Date
Nov 15, 2012, 01:37 UTC
Message-ID
<1352943474-15573-3-git-send-email-drafnel@gmail.com>
In-Reply-To
<1352943474-15573-1-git-send-email-drafnel@gmail.com>

ends_rfc2822_footer() was incorrectly checking whether the current line was a continuation of the previous line. It was actually checking the next line instead of the current line. Let's fix this and mark the test as expect_success.

Signed-off-by: Brandon Casey <bcasey@nvidia.com>
---
 sequencer.c              | 2 +-
 t/t3511-cherry-pick-x.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index be0cb8b..01edec2 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1040,7 +1040,7 @@ static int ends_rfc2822_footer(struct strbuf *sb, int ignore_footer)
 			; /* do nothing */
 		k++;
 
-		if ((buf[k] == ' ' || buf[k] == '\t') && !first)
+		if ((buf[i] == ' ' || buf[i] == '\t') && !first)
 			continue;
 
 		first = 0;
diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh
index b4e5c65..b2098e0 100755
--- a/t/t3511-cherry-pick-x.sh
+++ b/t/t3511-cherry-pick-x.sh
@@ -52,7 +52,7 @@ test_expect_success 'cherry-pick -s inserts blank line after non-rfc2822 footer'
 	test_cmp expect actual
 '
 
-test_expect_failure 'cherry-pick -s not confused by rfc2822 continuation line' '
+test_expect_success 'cherry-pick -s not confused by rfc2822 continuation line' '
 	pristine_detach initial &&
 	git cherry-pick -s rfc2822-base &&
 	cat <<-EOF >expect &&
-- 
1.8.0
Previous: Brandon CaseyNext: Brandon Casey
Message 5 of 14 in “t/test-lib-functions.sh: allow to specify the tag name to test_commit”
  1. 1/5 t/test-lib-functions.sh: allow to specify the tag name to test_commitBrandon Casey, Nov 15, 2012
  2. 2/5 t/t3511: demonstrate breakage in cherry-pick -sBrandon Casey, Nov 15, 2012
  3. Junio C HamanoNov 16, 2012
  4. Brandon CaseyNov 16, 2012
  5. 3/5 sequencer.c: handle rfc2822 continuation lines correctlyBrandon Casey, Nov 15, 2012
  6. 4/5 sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footerBrandon Casey, Nov 15, 2012
  7. 4/5 sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footerBrandon Casey, Nov 15, 2012
  8. 5/5 sequencer.c: always separate "(cherry picked from" from commit bodyBrandon Casey, Nov 15, 2012
  9. 6/5 sequencer.c: refrain from adding duplicate s-o-b linesBrandon Casey, Nov 15, 2012
  10. Junio C HamanoNov 16, 2012
  11. Brandon CaseyNov 16, 2012
  12. Matt KraaiNov 15, 2012
  13. Brandon CaseyNov 15, 2012
  14. 1/5 t/test-lib-functions.sh: allow to specify the tag name to test_commitBrandon Casey, Nov 15, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.