Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-08 22:24:14 +0300
committerJunio C Hamano <gitster@pobox.com>2010-12-08 22:24:14 +0300
commit23778ae9a08e9324f03898760b9e20b6b2dd6e23 (patch)
tree28f32b1e276fe01fdce276aff27f69a4b106319e /git.c
parent5e826019ef48e1d324c9a1866ed65f5be8990998 (diff)
parent9bad7233699e1fcf58e75f1e163499ec24680826 (diff)
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.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/git.c b/git.c
index 0409ac9fd3..81221cff46 100644
--- a/git.c
+++ b/git.c
@@ -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) {