All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
@ 2009-02-08  3:26 Jeremy White
  2009-02-08  5:10 ` Boyd Stephen Smith Jr.
  2009-02-10  1:41 ` [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch Junio C Hamano
  0 siblings, 2 replies; 46+ messages in thread
From: Jeremy White @ 2009-02-08  3:26 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]


Signed-off-by: Jeremy White <jwhite@codeweavers.com>
---
  Documentation/git-format-patch.txt |    4 +++-
  builtin-log.c                      |   15 +++++++++++++++
  2 files changed, 18 insertions(+), 1 deletions(-)



[-- Attachment #2: 7ed4bdd60ca12e71e1438defefbf83075b39a60b.diff --]
[-- Type: text/x-patch, Size: 1864 bytes --]

diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 11a7d77..2e8e94e 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -174,7 +174,8 @@ CONFIGURATION
 -------------
 You can specify extra mail header lines to be added to each message
 in the repository configuration, new defaults for the subject prefix
-and file suffix, and number patches when outputting more than one.
+and file suffix, control attachements, and number patches when outputting
+more than one.
 
 ------------
 [format]
@@ -183,6 +184,7 @@ and file suffix, and number patches when outputting more than one.
 	suffix = .txt
 	numbered = auto
 	cc = <email>
+	attach [ = mime-boundary-string ]
 ------------
 
 
diff --git a/builtin-log.c b/builtin-log.c
index 2ae39af..c79895c 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -428,6 +428,8 @@ static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
 static int auto_number = 1;
 
+static char *default_attach = NULL;
+
 static char **extra_hdr;
 static int extra_hdr_nr;
 static int extra_hdr_alloc;
@@ -488,6 +490,14 @@ static int git_format_config(const char *var, const char *value, void *cb)
 		auto_number = auto_number && numbered;
 		return 0;
 	}
+	if (!strcmp(var, "format.attach")) {
+		if (value && *value)
+			default_attach = xstrdup(value);
+		else
+			default_attach = xstrdup(git_version_string);
+		return 0;
+	}
+
 
 	return git_log_config(var, value, cb);
 }
@@ -787,6 +797,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
 	rev.subject_prefix = fmt_patch_subject_prefix;
 
+	if (default_attach) {
+		rev.mime_boundary = default_attach;
+		rev.no_inline = 1;
+	}
+
 	/*
 	 * Parse the arguments before setup_revisions(), or something
 	 * like "git format-patch -o a123 HEAD^.." may fail; a123 is


^ permalink raw reply related	[flat|nested] 46+ messages in thread
* [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
@ 2009-02-12 15:51 Jeremy White
  2009-02-12 21:01 ` Junio C Hamano
  0 siblings, 1 reply; 46+ messages in thread
From: Jeremy White @ 2009-02-12 15:51 UTC (permalink / raw)
  To: git

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
---

This v2 patch reflects a concern from Junio that you could
not temporarily override the configuration setting.


 Documentation/git-format-patch.txt |   11 +++++++++--
 builtin-log.c                      |   19 +++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 11a7d77..f89f73c 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -10,7 +10,8 @@ SYNOPSIS
 --------
 [verse]
 'git format-patch' [-k] [-o <dir> | --stdout] [--thread]
-		   [--attach[=<boundary>] | --inline[=<boundary>]]
+		   [--attach[=<boundary>] | --inline[=<boundary>] |
+		     [--noattach]]
 		   [-s | --signoff] [<common diff options>]
 		   [-n | --numbered | -N | --no-numbered]
 		   [--start-number <n>] [--numbered-files]
@@ -117,6 +118,10 @@ include::diff-options.txt[]
 	which is the commit message and the patch itself in the
 	second part, with "Content-Disposition: attachment".
 
+--noattach::
+	Disable the creation of an attachment, overriding the
+	configuration setting.
+
 --inline[=<boundary>]::
 	Create multipart/mixed attachment, the first part of
 	which is the commit message and the patch itself in the
@@ -174,7 +179,8 @@ CONFIGURATION
 -------------
 You can specify extra mail header lines to be added to each message
 in the repository configuration, new defaults for the subject prefix
-and file suffix, and number patches when outputting more than one.
+and file suffix, control attachements, and number patches when outputting
+more than one.
 
 ------------
 [format]
@@ -183,6 +189,7 @@ and file suffix, and number patches when outputting more than one.
 	suffix = .txt
 	numbered = auto
 	cc = <email>
+	attach [ = mime-boundary-string ]
 ------------
 
 
diff --git a/builtin-log.c b/builtin-log.c
index 2ae39af..991543a 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -428,6 +428,8 @@ static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
 static int auto_number = 1;
 
+static char *default_attach = NULL;
+
 static char **extra_hdr;
 static int extra_hdr_nr;
 static int extra_hdr_alloc;
@@ -488,6 +490,14 @@ static int git_format_config(const char *var, const char *value, void *cb)
 		auto_number = auto_number && numbered;
 		return 0;
 	}
+	if (!strcmp(var, "format.attach")) {
+		if (value && *value)
+			default_attach = xstrdup(value);
+		else
+			default_attach = xstrdup(git_version_string);
+		return 0;
+	}
+
 
 	return git_log_config(var, value, cb);
 }
@@ -787,6 +797,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
 	rev.subject_prefix = fmt_patch_subject_prefix;
 
+	if (default_attach) {
+		rev.mime_boundary = default_attach;
+		rev.no_inline = 1;
+	}
+
 	/*
 	 * Parse the arguments before setup_revisions(), or something
 	 * like "git format-patch -o a123 HEAD^.." may fail; a123 is
@@ -849,6 +864,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 			rev.mime_boundary = argv[i] + 9;
 			rev.no_inline = 1;
 		}
+		else if (!strcmp(argv[i], "--noattach")) {
+			rev.mime_boundary = NULL;
+			rev.no_inline = 0;
+		}
 		else if (!strcmp(argv[i], "--inline")) {
 			rev.mime_boundary = git_version_string;
 			rev.no_inline = 0;
-- 
1.6.2.rc0.57.g4ab7.dirty

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

end of thread, other threads:[~2009-02-12 21:02 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-08  3:26 [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch Jeremy White
2009-02-08  5:10 ` Boyd Stephen Smith Jr.
2009-02-08 16:01   ` Jeremy White
2009-02-08 17:28     ` Johannes Schindelin
2009-02-09 12:34       ` Michael J Gruber
2009-02-09 13:25         ` Ben Bucksch
2009-02-09 13:36           ` Johannes Schindelin
2009-02-09 13:50             ` Michael J Gruber
2009-02-09 14:39               ` Boyd Stephen Smith Jr.
2009-02-09 13:52             ` Ben Bucksch
2009-02-09 14:49               ` Johannes Schindelin
2009-02-09 13:52             ` Thunderbird and patches (was Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.) Jeremy White
2009-02-09 14:18               ` Ben Bucksch
2009-02-09 15:38                 ` Jeremy White
2009-02-09 15:54                   ` Michael J Gruber
2009-02-09 16:24                     ` Ben Bucksch
2009-02-09 18:06                       ` Jeremy White
2009-02-09 18:54                       ` Brandon Casey
2009-02-09 19:09                         ` Ben Bucksch
2009-02-09 19:14                           ` Johannes Schindelin
2009-02-09 19:20                             ` Ben Bucksch
2009-02-09 19:30                               ` Brandon Casey
2009-02-09 19:51                                 ` Ben Bucksch
2009-02-09 19:59                                   ` Ben Bucksch
2009-02-09 21:03                                     ` Brandon Casey
2009-02-09 21:07                                       ` Brandon Casey
2009-02-09 22:01                                       ` Ben Bucksch
2009-02-09 22:13                                         ` Brandon Casey
2009-02-09 22:25                                           ` Ben Bucksch
2009-02-09 22:28                                             ` Brandon Casey
2009-02-09 22:46                                               ` Ben Bucksch
2009-02-10  1:00                                                 ` Brandon Casey
2009-02-09 19:33                             ` Brandon Casey
2009-02-09 20:09                               ` Johannes Schindelin
2009-02-10 10:07                                 ` Michael J Gruber
2009-02-12  4:37                                   ` Thunderbird and patches Miles Bader
2009-02-12 10:07                                     ` Michael J Gruber
2009-02-09 19:22                           ` Thunderbird and patches (was Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.) Brandon Casey
2009-02-09 19:00                       ` [PATCH] example patch corrupted by thunderbird Brandon Casey
2009-02-09 15:49                 ` Thunderbird and patches (was Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.) Michael J Gruber
2009-02-09 22:39               ` Thunderbird and patches Ben Bucksch
2009-02-09 22:55                 ` Jeremy White
2009-02-09 23:01                   ` Ben Bucksch
2009-02-10  1:41 ` [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch Junio C Hamano
2009-02-12 15:51 Jeremy White
2009-02-12 21:01 ` Junio C Hamano

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.