diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-08 11:24:14 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-08 11:24:14 -0800 |
commit | 23778ae9a08e9324f03898760b9e20b6b2dd6e23 (patch) | |
tree | 28f32b1e276fe01fdce276aff27f69a4b106319e /git.c | |
parent | 5e826019ef48e1d324c9a1866ed65f5be8990998 (diff) | |
parent | 9bad7233699e1fcf58e75f1e163499ec24680826 (diff) | |
download | git-23778ae9a08e9324f03898760b9e20b6b2dd6e23.tar.gz |
Merge branch 'jk/pager-per-command'
* jk/pager-per-command:
allow command-specific pagers in pager.<cmd>
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -19,14 +19,22 @@ static struct startup_info git_startup_info; static int use_pager = -1; struct pager_config { const char *cmd; - int val; + int want; + char *value; }; static int pager_command_config(const char *var, const char *value, void *data) { struct pager_config *c = data; - if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) - c->val = git_config_bool(var, value); + if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) { + int b = git_config_maybe_bool(var, value); + if (b >= 0) + c->want = b; + else { + c->want = 1; + c->value = xstrdup(value); + } + } return 0; } @@ -35,9 +43,12 @@ int check_pager_config(const char *cmd) { struct pager_config c; c.cmd = cmd; - c.val = -1; + c.want = -1; + c.value = NULL; git_config(pager_command_config, &c); - return c.val; + if (c.value) + pager_program = c.value; + return c.want; } static void commit_pager_choice(void) { |