{"thread":{"id":"17750","subject":"[PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.","startedAt":"2009-02-12T15:51:55Z","lastAt":"2009-02-12T21:01:25Z","messageCount":2,"participants":["Jeremy White","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"104392","messageId":"4994459B.8090002@codeweavers.com","threadId":"17750","inReplyTo":null,"subject":"[PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.","fromName":"Jeremy White","fromEmail":"jwhite@codeweavers.com","sentAt":"2009-02-12T15:51:55Z","receivedAt":"2009-02-12T15:51:55Z","isPatch":true,"sender":{"key":"jwhite@codeweavers.com","avatar":"https://avatars.githubusercontent.com/u/1063742?v=4"},"body":"Signed-off-by: Jeremy White <jwhite@codeweavers.com>\n---\n\nThis v2 patch reflects a concern from Junio that you could\nnot temporarily override the configuration setting.\n\n\n Documentation/git-format-patch.txt |   11 +++++++++--\n builtin-log.c                      |   19 +++++++++++++++++++\n 2 files changed, 28 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 11a7d77..f89f73c 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -10,7 +10,8 @@ SYNOPSIS\n --------\n [verse]\n 'git format-patch' [-k] [-o <dir> | --stdout] [--thread]\n-\t\t   [--attach[=<boundary>] | --inline[=<boundary>]]\n+\t\t   [--attach[=<boundary>] | --inline[=<boundary>] |\n+\t\t     [--noattach]]\n \t\t   [-s | --signoff] [<common diff options>]\n \t\t   [-n | --numbered | -N | --no-numbered]\n \t\t   [--start-number <n>] [--numbered-files]\n@@ -117,6 +118,10 @@ include::diff-options.txt[]\n \twhich is the commit message and the patch itself in the\n \tsecond part, with \"Content-Disposition: attachment\".\n \n+--noattach::\n+\tDisable the creation of an attachment, overriding the\n+\tconfiguration setting.\n+\n --inline[=<boundary>]::\n \tCreate multipart/mixed attachment, the first part of\n \twhich is the commit message and the patch itself in the\n@@ -174,7 +179,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 +189,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..991543a 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 = NULL;\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@@ -849,6 +864,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\trev.mime_boundary = argv[i] + 9;\n \t\t\trev.no_inline = 1;\n \t\t}\n+\t\telse if (!strcmp(argv[i], \"--noattach\")) {\n+\t\t\trev.mime_boundary = NULL;\n+\t\t\trev.no_inline = 0;\n+\t\t}\n \t\telse if (!strcmp(argv[i], \"--inline\")) {\n \t\t\trev.mime_boundary = git_version_string;\n \t\t\trev.no_inline = 0;\n-- \n1.6.2.rc0.57.g4ab7.dirty\n"},{"id":"104417","messageId":"7vljsbl68q.fsf@gitster.siamese.dyndns.org","threadId":"17750","inReplyTo":"4994459B.8090002@codeweavers.com","subject":"Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-12T21:01:25Z","receivedAt":"2009-02-12T21:01:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeremy White <jwhite@codeweavers.com> writes:\n\n> diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\n> index 11a7d77..f89f73c 100644\n> --- a/Documentation/git-format-patch.txt\n> +++ b/Documentation/git-format-patch.txt\n> @@ -10,7 +10,8 @@ SYNOPSIS\n>  --------\n>  [verse]\n>  'git format-patch' [-k] [-o <dir> | --stdout] [--thread]\n> -\t\t   [--attach[=<boundary>] | --inline[=<boundary>]]\n> +\t\t   [--attach[=<boundary>] | --inline[=<boundary>] |\n> +\t\t     [--noattach]]\n\nHmph, don't we usually do this with --no-attach?  Especially when\nformat-patch starts using parse_options, I suspect that would be how the\nAPI gives negated options natively.\n\nIf there are no other issues people find in this patch, I'll amend it to\nuse dash between no and attach and apply (hence no need to resend).\n\nThanks.\n"}]}