aboutsummaryrefslogtreecommitdiff
path: root/builtin/log.c
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2016-07-30 02:41:56 -0700
committerJunio C Hamano <gitster@pobox.com>2016-08-01 13:13:02 -0700
commit6bc6b6c0dc0a58874a7a6b9afc3156a5cf9bb10d (patch)
tree05343b68df9de90923ea0fc2d3088f86321d2816 /builtin/log.c
parent08df31eeccfe1576971ea4ba42570a424c3cfc41 (diff)
downloadgit-6bc6b6c0dc0a58874a7a6b9afc3156a5cf9bb10d.tar.gz
git-6bc6b6c0dc0a58874a7a6b9afc3156a5cf9bb10d.tar.xz
format-patch: format.from gives the default for --from
This helps users who would prefer format-patch to default to --from, and makes it easier to change the default in the future. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/log.c')
-rw-r--r--builtin/log.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 099f4f7be..13ebe7a75 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -703,6 +703,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;
@@ -791,6 +792,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);
}
@@ -1368,7 +1380,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;