[PATCH] format-patch: add --no-inline option

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

 



Some projects have a "patches are not to be inlined" policy. Support
these by adding an option to turn off inlined attachments.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx>

---

	On Sat, 3 Mar 2007, Johannes Schindelin wrote:

	> ... so we should introduce an option "--no-inline"!

	I.e. something like this. If you want this, I leave it to you to 
	add a config variable to set the default (but then, you have to 
	add an option "--inline", too!).

 builtin-log.c |    2 ++
 log-tree.c    |    6 ++++--
 revision.h    |    1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 1c9f7d0..3b73feb 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -486,6 +486,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 			rev.mime_boundary = git_version_string;
 		else if (!prefixcmp(argv[i], "--attach="))
 			rev.mime_boundary = argv[i] + 9;
+		else if (!strcmp(argv[i], "--no-inline"))
+			rev.no_inline = 1;
 		else if (!strcmp(argv[i], "--ignore-if-in-upstream"))
 			ignore_if_in_upstream = 1;
 		else if (!strcmp(argv[i], "--thread"))
diff --git a/log-tree.c b/log-tree.c
index 6ce239d..7b3ad7d 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -205,10 +205,12 @@ void show_log(struct rev_info *opt, const char *sep)
 				 "Content-Type: text/x-patch;\n"
 				 " name=\"%s.diff\"\n"
 				 "Content-Transfer-Encoding: 8bit\n"
-				 "Content-Disposition: inline;\n"
+				 "Content-Disposition: %s;\n"
 				 " filename=\"%s.diff\"\n\n",
 				 mime_boundary_leader, opt->mime_boundary,
-				 sha1, sha1);
+				 sha1,
+				 opt->no_inline ? "attachment" : "inline",
+				 sha1);
 			opt->diffopt.stat_sep = buffer;
 		}
 	} else if (opt->commit_format != CMIT_FMT_USERFORMAT) {
diff --git a/revision.h b/revision.h
index 5fec184..cf33713 100644
--- a/revision.h
+++ b/revision.h
@@ -74,6 +74,7 @@ struct rev_info {
 	const char	*add_signoff;
 	const char	*extra_headers;
 	const char	*log_reencode;
+	int		no_inline;
 
 	/* Filter by commit log message */
 	struct grep_opt	*grep_filter;
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]