summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e04228)
raw | patch | inline | side by side (parent: 3e04228)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 31 Jul 2006 09:53:46 +0000 (02:53 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 31 Jul 2006 22:32:23 +0000 (15:32 -0700) |
This moves the built-in "always-use-pager" logic for log family
to the command dispatch table of git wrapper. This makes it
easier to change the default use of pager, and has an added
benefit that we fork and exec the pager early before packs are
mmapped.
Pointed out by Juergen Ruehle <j.ruehle@bmiag.de>.
Signed-off-by: Junio C Hamano <junkio@cox.net>
to the command dispatch table of git wrapper. This makes it
easier to change the default use of pager, and has an added
benefit that we fork and exec the pager early before packs are
mmapped.
Pointed out by Juergen Ruehle <j.ruehle@bmiag.de>.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-log.c | patch | blob | history | |
git.c | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index 82c69d1d0593156c5f7034746fe68f5a1a9f7276..bba1496bf20fb14ad994f8ddacc82ec990d412d8 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
struct commit *commit;
prepare_revision_walk(rev);
- setup_pager();
while ((commit = get_revision(rev)) != NULL) {
log_tree_commit(rev, commit);
free(commit->buffer);
index 7321d6c3f636ef8bd4870ead06be54c037ccef9b..d031eb9a1868befaa546e230579152b35591054e 100644 (file)
--- a/git.c
+++ b/git.c
const char git_version_string[] = GIT_VERSION;
#define NEEDS_PREFIX 1
+#define USE_PAGER 2
static void handle_internal_command(int argc, const char **argv, char **envp)
{
static struct cmd_struct {
const char *cmd;
int (*fn)(int, const char **, const char *);
- int prefix;
+ int option;
} commands[] = {
{ "version", cmd_version },
{ "help", cmd_help },
- { "log", cmd_log, NEEDS_PREFIX },
- { "whatchanged", cmd_whatchanged, NEEDS_PREFIX },
- { "show", cmd_show, NEEDS_PREFIX },
+ { "log", cmd_log, NEEDS_PREFIX | USE_PAGER },
+ { "whatchanged", cmd_whatchanged, NEEDS_PREFIX | USE_PAGER },
+ { "show", cmd_show, NEEDS_PREFIX | USE_PAGER },
{ "push", cmd_push },
{ "format-patch", cmd_format_patch, NEEDS_PREFIX },
{ "count-objects", cmd_count_objects },
continue;
prefix = NULL;
- if (p->prefix)
+ if (p->option & NEEDS_PREFIX)
prefix = setup_git_directory();
+ if (p->option & USE_PAGER)
+ setup_pager();
if (getenv("GIT_TRACE")) {
int i;
fprintf(stderr, "trace: built-in: git");