diff options
author | Jeremy White <jwhite@codeweavers.com> | 2009-02-12 09:51:55 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-12 14:48:43 -0800 |
commit | 0db5260bd033cc357186cc13fe23be9635ad69e7 (patch) | |
tree | 4507afc0af8cf3994fe3decb8e4f8dc13c0c86ad /builtin-log.c | |
parent | 30aa4fb15fa408596dea59cdc9f00c94eeaa69f1 (diff) | |
download | git-0db5260bd033cc357186cc13fe23be9635ad69e7.tar.gz git-0db5260bd033cc357186cc13fe23be9635ad69e7.tar.xz |
Enable setting attach as the default in .gitconfig for git-format-patch.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/builtin-log.c b/builtin-log.c index 2ae39afcc..854902881 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], "--no-attach")) { + rev.mime_boundary = NULL; + rev.no_inline = 0; + } else if (!strcmp(argv[i], "--inline")) { rev.mime_boundary = git_version_string; rev.no_inline = 0; |