diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2009-10-30 20:41:27 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-13 12:20:47 -0800 |
commit | 6361824589bc2d32989a9a33f985d09a368436a3 (patch) | |
tree | 31050baa04194fee66e0c05b0e9569c538b41925 /var.c | |
parent | 44fcb4977cbae67f4698306ccfe982420ceebcbf (diff) | |
download | git-6361824589bc2d32989a9a33f985d09a368436a3.tar.gz |
Teach git var about GIT_PAGER
Expose the command found by setup_pager() for scripts to use.
Scripts can use this to avoid repeating the logic to look for a
proper pager in each command.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'var.c')
-rw-r--r-- | var.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -18,6 +18,15 @@ static const char *editor(int flag) return pgm; } +static const char *pager(int flag) +{ + const char *pgm = git_pager(); + + if (!pgm) + pgm = "cat"; + return pgm; +} + struct git_var { const char *name; const char *(*read)(int); @@ -26,6 +35,7 @@ static struct git_var git_vars[] = { { "GIT_COMMITTER_IDENT", git_committer_info }, { "GIT_AUTHOR_IDENT", git_author_info }, { "GIT_EDITOR", editor }, + { "GIT_PAGER", pager }, { "", NULL }, }; |