summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-03-05 15:41:41 -0800
committerJunio C Hamano <gitster@pobox.com>2009-03-05 15:41:41 -0800
commit2247b45c607675a5bf7813380c5c63ab24aaba36 (patch)
tree7576ec9249df898dda146ac133ff230c699a3d6b /builtin-log.c
parente7cf1da70f1bbb477614547ca2874392c9d37862 (diff)
parent0db5260bd033cc357186cc13fe23be9635ad69e7 (diff)
downloadgit-2247b45c607675a5bf7813380c5c63ab24aaba36.tar.gz
Merge branch 'jw/format-patch-attach'
* jw/format-patch-attach: Enable setting attach as the default in .gitconfig for git-format-patch.
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 2ae39afccd..8549028817 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;