aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-08-10 12:33:18 -0700
committerJunio C Hamano <gitster@pobox.com>2016-08-10 12:33:18 -0700
commitdb40a622395397c84c247d343ef62acc8775d6b2 (patch)
tree505448d2b765d17ce009e12809315fb07bb457d4 /builtin
parente6747627865347a534e7106bb1d14e32867b234d (diff)
parent6bc6b6c0dc0a58874a7a6b9afc3156a5cf9bb10d (diff)
downloadgit-db40a622395397c84c247d343ef62acc8775d6b2.tar.gz
git-db40a622395397c84c247d343ef62acc8775d6b2.tar.xz
Merge branch 'jt/format-patch-from-config'
"git format-patch" learned format.from configuration variable to specify the default settings for its "--from" option. * jt/format-patch-from-config: format-patch: format.from gives the default for --from
Diffstat (limited to 'builtin')
-rw-r--r--builtin/log.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/builtin/log.c b/builtin/log.c
index fd1652f52..1f116bea8 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -719,6 +719,7 @@ static void add_header(const char *value)
static int thread;
static int do_signoff;
static int base_auto;
+static char *from;
static const char *signature = git_version_string;
static const char *signature_file;
static int config_cover_letter;
@@ -807,6 +808,17 @@ static int git_format_config(const char *var, const char *value, void *cb)
base_auto = git_config_bool(var, value);
return 0;
}
+ if (!strcmp(var, "format.from")) {
+ int b = git_config_maybe_bool(var, value);
+ free(from);
+ if (b < 0)
+ from = xstrdup(value);
+ else if (b)
+ from = xstrdup(git_committer_info(IDENT_NO_DATE));
+ else
+ from = NULL;
+ return 0;
+ }
return git_log_config(var, value, cb);
}
@@ -1384,7 +1396,6 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
int quiet = 0;
int reroll_count = -1;
char *branch_name = NULL;
- char *from = NULL;
char *base_commit = NULL;
struct base_tree_info bases;