git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make find_commit_subject() more robust
@ 2016-06-18 13:12 Johannes Schindelin
  2016-06-20 19:35 ` Junio C Hamano
  2016-06-21 12:43 ` [PATCH v2] " Johannes Schindelin
  0 siblings, 2 replies; 15+ messages in thread
From: Johannes Schindelin @ 2016-06-18 13:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Just like the pretty printing machinery, we should simply ignore empty
lines at the beginning of the commit messages.

This discrepancy was noticed when an early version of the rebase--helper
produced commit objects with more than one empty line between the header
and the commit message.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Published-As: https://github.com/dscho/git/releases/tag/leading-empty-lines-v1

	Aaaaand another patch from the rebase--helper front. I guess I'll
	call it a day with this one.

 commit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/commit.c b/commit.c
index 3f4f371..7b00989 100644
--- a/commit.c
+++ b/commit.c
@@ -415,6 +415,8 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
 		p++;
 	if (*p) {
 		p += 2;
+		while (*p == '\n')
+			p++;
 		for (eol = p; *eol && *eol != '\n'; eol++)
 			; /* do nothing */
 	} else
-- 
2.9.0.119.gb7b8d21

base-commit: 05219a1276341e72d8082d76b7f5ed394b7437a4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-06-22 20:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-18 13:12 [PATCH] Make find_commit_subject() more robust Johannes Schindelin
2016-06-20 19:35 ` Junio C Hamano
2016-06-21 12:03   ` Johannes Schindelin
2016-06-21 21:15     ` Junio C Hamano
2016-06-22  9:03       ` Johannes Schindelin
2016-06-21 12:43 ` [PATCH v2] " Johannes Schindelin
2016-06-21 20:34   ` Junio C Hamano
2016-06-22  9:34   ` [PATCH v3 0/2] Make find_commit_subject() consistent with --format=%s Johannes Schindelin
2016-06-22  9:34     ` [PATCH v3 1/2] Make the skip_empty_lines() function public Johannes Schindelin
2016-06-22  9:34     ` [PATCH v3 2/2] Make find_commit_subject() more robust Johannes Schindelin
2016-06-22 17:21     ` [PATCH v3 0/2] Make find_commit_subject() consistent with --format=%s Junio C Hamano
2016-06-22 20:20       ` Johannes Schindelin
2016-06-22 20:20     ` [PATCH v4 " Johannes Schindelin
2016-06-22 20:20       ` [PATCH v4 1/2] Make the skip_blank_lines() function public Johannes Schindelin
2016-06-22 20:20       ` [PATCH v4 2/2] Make find_commit_subject() more robust Johannes Schindelin

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).