{"thread":{"id":"17657","subject":"[PATCH v3] Enable setting attach as the default in .gitconfig for git-format-patch.","startedAt":"2009-02-08T19:24:52Z","lastAt":"2009-02-08T19:24:52Z","messageCount":1,"participants":["Jeremy White"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"103771","messageId":"498F3184.30809@codeweavers.com","threadId":"17657","inReplyTo":null,"subject":"[PATCH v3] Enable setting attach as the default in .gitconfig for git-format-patch.","fromName":"Jeremy White","fromEmail":"jwhite@codeweavers.com","sentAt":"2009-02-08T19:24:52Z","receivedAt":"2009-02-08T19:24:52Z","isPatch":true,"sender":{"key":"jwhite@codeweavers.com","avatar":"https://avatars.githubusercontent.com/u/1063742?v=4"},"body":"---\n Documentation/git-format-patch.txt |    4 +++-\n builtin-log.c                      |   15 +++++++++++++++\n 2 files changed, 18 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 11a7d77..2e8e94e 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -174,7 +174,8 @@ CONFIGURATION\n -------------\n You can specify extra mail header lines to be added to each message\n in the repository configuration, new defaults for the subject prefix\n-and file suffix, and number patches when outputting more than one.\n+and file suffix, control attachements, and number patches when outputting\n+more than one.\n \n ------------\n [format]\n@@ -183,6 +184,7 @@ and file suffix, and number patches when outputting more than one.\n \tsuffix = .txt\n \tnumbered = auto\n \tcc = <email>\n+\tattach [ = mime-boundary-string ]\n ------------\n \n \ndiff --git a/builtin-log.c b/builtin-log.c\nindex 2ae39af..dac0dfd 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -428,6 +428,8 @@ static const char *fmt_patch_suffix = \".patch\";\n static int numbered = 0;\n static int auto_number = 1;\n \n+static char *default_attach;\n+\n static char **extra_hdr;\n static int extra_hdr_nr;\n static int extra_hdr_alloc;\n@@ -488,6 +490,14 @@ static int git_format_config(const char *var, const char *value, void *cb)\n \t\tauto_number = auto_number && numbered;\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"format.attach\")) {\n+\t\tif (value && *value)\n+\t\t\tdefault_attach = xstrdup(value);\n+\t\telse\n+\t\t\tdefault_attach = xstrdup(git_version_string);\n+\t\treturn 0;\n+\t}\n+\n \n \treturn git_log_config(var, value, cb);\n }\n@@ -787,6 +797,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \n \trev.subject_prefix = fmt_patch_subject_prefix;\n \n+\tif (default_attach) {\n+\t\trev.mime_boundary = default_attach;\n+\t\trev.no_inline = 1;\n+\t}\n+\n \t/*\n \t * Parse the arguments before setup_revisions(), or something\n \t * like \"git format-patch -o a123 HEAD^..\" may fail; a123 is\n-- \n1.6.1.2.390.gba743.dirty\n"}]}