[PATCH v5 4/6] pretty: allow caller to disable indentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Most pretty formats indent the commit message with 4 spaces. Add field
`no_indent` to `struct pretty_print_context` to suppress this
indentation.

Signed-off-by: Toon Claes <toon@xxxxxxxxx>

# Conflicts:
#	pretty.h

Signed-off-by: Toon Claes <toon@xxxxxxxxx>
---
 pretty.c | 2 +-
 pretty.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/pretty.c b/pretty.c
index 0bc8ad8a9a..9b1698417e 100644
--- a/pretty.c
+++ b/pretty.c
@@ -2286,7 +2286,7 @@ void pretty_print_commit(struct pretty_print_context *pp,
 			 struct strbuf *sb)
 {
 	unsigned long beginning_of_body;
-	int indent = 4;
+	int indent = pp->no_indent ? 0 : 4;
 	const char *msg;
 	const char *reencoded;
 	const char *encoding;
diff --git a/pretty.h b/pretty.h
index df267afe4a..5d25ae2320 100644
--- a/pretty.h
+++ b/pretty.h
@@ -50,6 +50,7 @@ struct pretty_print_context {
 	struct ident_split *from_ident;
 	unsigned encode_email_headers:1;
 	struct pretty_print_describe_status *describe_status;
+	int no_indent;

 	/*
 	 * Fields below here are manipulated internally by pp_* functions and
--
2.50.1.327.g047016eb4a




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux