{"thread":{"id":"13351","subject":"To page or not to page","startedAt":"2008-05-02T05:41:05Z","lastAt":"2008-05-16T10:29:17Z","messageCount":31,"participants":["Kevin Ballard","Jeff King","Junio C Hamano","Jakub Narebski","Johannes Schindelin","Pedro Melo","Wincent Colaiuta","Bart Trojanowski","Aidan Van Dyk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"75800","messageId":"70F76C0E-E16D-4047-873D-7FD19FDBB55D@sb.org","threadId":"13351","inReplyTo":null,"subject":"To page or not to page","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2008-05-02T05:41:05Z","receivedAt":"2008-05-02T05:41:05Z","isPatch":false,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"c8af1de9cfa0a5678ae766777e0f905e60b69fda makes git status use a pager.  \nI think this is a horrible choice. Now when I type `git status` I have  \nto type \"q\" to get back to my shell, and I've lost the output of the  \npager. It makes sense for commands with long output like `git log`,  \nbut `git status` rarely has output longer than my terminal's height,  \nand so making it use the pager simply detracts from its functionality.\n\nDoes anybody have any comments or opinions about this either way?\n\n-Kevin Ballard\n\n-- \nKevin Ballard\nhttp://kevin.sb.org\nkevin@sb.org\nhttp://www.tildesoft.com\n"},{"id":"75801","messageId":"20080502054508.GA28506@sigill.intra.peff.net","threadId":"13351","inReplyTo":"70F76C0E-E16D-4047-873D-7FD19FDBB55D@sb.org","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T05:45:09Z","receivedAt":"2008-05-02T05:45:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 01:41:05AM -0400, Kevin Ballard wrote:\n\n> c8af1de9cfa0a5678ae766777e0f905e60b69fda makes git status use a pager. I \n> think this is a horrible choice. Now when I type `git status` I have to \n> type \"q\" to get back to my shell, and I've lost the output of the pager. \n> It makes sense for commands with long output like `git log`, but `git \n> status` rarely has output longer than my terminal's height, and so making \n> it use the pager simply detracts from its functionality.\n>\n> Does anybody have any comments or opinions about this either way?\n\nI agree with you; I don't like it at all. Probably whether or not to use\na pager for a given command should be controlled by a \"pager.<cmd>\"\nconfig variable.\n\nIn the meantime, try adding FX to your LESS environment variable.\n\n-Peff\n"},{"id":"75802","messageId":"7vlk2txn8n.fsf@gitster.siamese.dyndns.org","threadId":"13351","inReplyTo":"20080502054508.GA28506@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-02T05:56:40Z","receivedAt":"2008-05-02T05:56:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, May 02, 2008 at 01:41:05AM -0400, Kevin Ballard wrote:\n>\n>> Does anybody have any comments or opinions about this either way?\n>\n> I agree with you; I don't like it at all.\n\nI do not care either way.  As I do not have LESS defined in my environment\n(which makes git use its built-in that contains FX), I actually never\nnoticed the difference before or after that patch.\n\nHmmm, I thought I heard you cheered on that patch?  Perhaps it was\nsomebody else.\n"},{"id":"75803","messageId":"8C3474E2-3A4F-44E8-B301-C36939C7BA11@sb.org","threadId":"13351","inReplyTo":"7vlk2txn8n.fsf@gitster.siamese.dyndns.org","subject":"Re: To page or not to page","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2008-05-02T06:04:01Z","receivedAt":"2008-05-02T06:04:01Z","isPatch":false,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On May 2, 2008, at 1:56 AM, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n>\n>> On Fri, May 02, 2008 at 01:41:05AM -0400, Kevin Ballard wrote:\n>>\n>>> Does anybody have any comments or opinions about this either way?\n>>\n>> I agree with you; I don't like it at all.\n>\n> I do not care either way.  As I do not have LESS defined in my  \n> environment\n> (which makes git use its built-in that contains FX), I actually never\n> noticed the difference before or after that patch.\n\nEven if I put FX into LESS (I have it set normally so it contains R),  \nit still doesn't behave correctly. I compulsively clear my terminal  \nscreen whenever I don't need the current contents, but with FX in  \nLESS, `git status` throws the output at the bottom of my terminal,  \nleaving a lot of blank space at the top. This is extremely irritating  \nto me.\n\nIs there any good reason to make git-status use the pager? The output  \nis very rarely long enough to warrant it, and if I need a pager I can  \nalways just pipe it to less myself.\n\n-Kevin Ballard\n\n-- \nKevin Ballard\nhttp://kevin.sb.org\nkevin@sb.org\nhttp://www.tildesoft.com\n"},{"id":"75804","messageId":"7vhcdhxmpr.fsf@gitster.siamese.dyndns.org","threadId":"13351","inReplyTo":"8C3474E2-3A4F-44E8-B301-C36939C7BA11@sb.org","subject":"Re: To page or not to page","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-02T06:08:00Z","receivedAt":"2008-05-02T06:08:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kevin Ballard <kevin@sb.org> writes:\n\n> Is there any good reason to make git-status use the pager? The output\n> is very rarely long enough to warrant it, and if I need a pager I can\n> always just pipe it to less myself.\n\nI have no motivation to defend that change.  I'll leave that to the\noriginal submitter and list archive ;-)\n"},{"id":"75805","messageId":"20080502060930.GA1079@sigill.intra.peff.net","threadId":"13351","inReplyTo":"20080502054508.GA28506@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T06:09:30Z","receivedAt":"2008-05-02T06:09:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 01:45:08AM -0400, Jeff King wrote:\n\n> I agree with you; I don't like it at all. Probably whether or not to use\n> a pager for a given command should be controlled by a \"pager.<cmd>\"\n> config variable.\n\nHere is a quick and dirty patch to do that. It should probably be split\ninto two (there is a big code movement of the commands array), and it\nneeds documentation and tests. But I'm going to sleep for now.\n\ndiff --git a/git.c b/git.c\nindex 89b431f..ffb2650 100644\n--- a/git.c\n+++ b/git.c\n@@ -6,6 +6,8 @@\n const char git_usage_string[] =\n \t\"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]\";\n \n+int git_wrapper_config(const char *, const char *);\n+\n static int handle_options(const char*** argv, int* argc, int* envchanged)\n {\n \tint handled = 0;\n@@ -239,6 +241,7 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)\n \tprefix = NULL;\n \tif (p->option & RUN_SETUP)\n \t\tprefix = setup_git_directory();\n+\tgit_config(git_wrapper_config);\n \tif (p->option & USE_PAGER)\n \t\tsetup_pager();\n \tif (p->option & NEED_WORK_TREE)\n@@ -267,103 +270,103 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)\n \treturn 0;\n }\n \n+static struct cmd_struct commands[] = {\n+\t{ \"add\", cmd_add, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"annotate\", cmd_annotate, RUN_SETUP },\n+\t{ \"apply\", cmd_apply },\n+\t{ \"archive\", cmd_archive },\n+\t{ \"blame\", cmd_blame, RUN_SETUP },\n+\t{ \"branch\", cmd_branch, RUN_SETUP },\n+\t{ \"bundle\", cmd_bundle },\n+\t{ \"cat-file\", cmd_cat_file, RUN_SETUP },\n+\t{ \"checkout\", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"checkout-index\", cmd_checkout_index, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"check-ref-format\", cmd_check_ref_format },\n+\t{ \"check-attr\", cmd_check_attr, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"cherry\", cmd_cherry, RUN_SETUP },\n+\t{ \"cherry-pick\", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"clean\", cmd_clean, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"commit\", cmd_commit, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"commit-tree\", cmd_commit_tree, RUN_SETUP },\n+\t{ \"config\", cmd_config },\n+\t{ \"count-objects\", cmd_count_objects, RUN_SETUP },\n+\t{ \"describe\", cmd_describe, RUN_SETUP },\n+\t{ \"diff\", cmd_diff },\n+\t{ \"diff-files\", cmd_diff_files },\n+\t{ \"diff-index\", cmd_diff_index, RUN_SETUP },\n+\t{ \"diff-tree\", cmd_diff_tree, RUN_SETUP },\n+\t{ \"fast-export\", cmd_fast_export, RUN_SETUP },\n+\t{ \"fetch\", cmd_fetch, RUN_SETUP },\n+\t{ \"fetch-pack\", cmd_fetch_pack, RUN_SETUP },\n+\t{ \"fetch--tool\", cmd_fetch__tool, RUN_SETUP },\n+\t{ \"fmt-merge-msg\", cmd_fmt_merge_msg, RUN_SETUP },\n+\t{ \"for-each-ref\", cmd_for_each_ref, RUN_SETUP },\n+\t{ \"format-patch\", cmd_format_patch, RUN_SETUP },\n+\t{ \"fsck\", cmd_fsck, RUN_SETUP },\n+\t{ \"fsck-objects\", cmd_fsck, RUN_SETUP },\n+\t{ \"gc\", cmd_gc, RUN_SETUP },\n+\t{ \"get-tar-commit-id\", cmd_get_tar_commit_id },\n+\t{ \"grep\", cmd_grep, RUN_SETUP | USE_PAGER },\n+\t{ \"help\", cmd_help },\n+#ifndef NO_CURL\n+\t{ \"http-fetch\", cmd_http_fetch, RUN_SETUP },\n+#endif\n+\t{ \"init\", cmd_init_db },\n+\t{ \"init-db\", cmd_init_db },\n+\t{ \"log\", cmd_log, RUN_SETUP | USE_PAGER },\n+\t{ \"ls-files\", cmd_ls_files, RUN_SETUP },\n+\t{ \"ls-tree\", cmd_ls_tree, RUN_SETUP },\n+\t{ \"ls-remote\", cmd_ls_remote },\n+\t{ \"mailinfo\", cmd_mailinfo },\n+\t{ \"mailsplit\", cmd_mailsplit },\n+\t{ \"merge-base\", cmd_merge_base, RUN_SETUP },\n+\t{ \"merge-file\", cmd_merge_file },\n+\t{ \"merge-ours\", cmd_merge_ours, RUN_SETUP },\n+\t{ \"merge-recursive\", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"merge-subtree\", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"mv\", cmd_mv, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"name-rev\", cmd_name_rev, RUN_SETUP },\n+\t{ \"pack-objects\", cmd_pack_objects, RUN_SETUP },\n+\t{ \"peek-remote\", cmd_ls_remote },\n+\t{ \"pickaxe\", cmd_blame, RUN_SETUP },\n+\t{ \"prune\", cmd_prune, RUN_SETUP },\n+\t{ \"prune-packed\", cmd_prune_packed, RUN_SETUP },\n+\t{ \"push\", cmd_push, RUN_SETUP },\n+\t{ \"read-tree\", cmd_read_tree, RUN_SETUP },\n+\t{ \"reflog\", cmd_reflog, RUN_SETUP },\n+\t{ \"remote\", cmd_remote, RUN_SETUP },\n+\t{ \"repo-config\", cmd_config },\n+\t{ \"rerere\", cmd_rerere, RUN_SETUP },\n+\t{ \"reset\", cmd_reset, RUN_SETUP },\n+\t{ \"rev-list\", cmd_rev_list, RUN_SETUP },\n+\t{ \"rev-parse\", cmd_rev_parse },\n+\t{ \"revert\", cmd_revert, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"rm\", cmd_rm, RUN_SETUP },\n+\t{ \"send-pack\", cmd_send_pack, RUN_SETUP },\n+\t{ \"shortlog\", cmd_shortlog, USE_PAGER },\n+\t{ \"show-branch\", cmd_show_branch, RUN_SETUP },\n+\t{ \"show\", cmd_show, RUN_SETUP | USE_PAGER },\n+\t{ \"status\", cmd_status, RUN_SETUP | NEED_WORK_TREE | USE_PAGER },\n+\t{ \"stripspace\", cmd_stripspace },\n+\t{ \"symbolic-ref\", cmd_symbolic_ref, RUN_SETUP },\n+\t{ \"tag\", cmd_tag, RUN_SETUP },\n+\t{ \"tar-tree\", cmd_tar_tree },\n+\t{ \"unpack-objects\", cmd_unpack_objects, RUN_SETUP },\n+\t{ \"update-index\", cmd_update_index, RUN_SETUP },\n+\t{ \"update-ref\", cmd_update_ref, RUN_SETUP },\n+\t{ \"upload-archive\", cmd_upload_archive },\n+\t{ \"verify-tag\", cmd_verify_tag, RUN_SETUP },\n+\t{ \"version\", cmd_version },\n+\t{ \"whatchanged\", cmd_whatchanged, RUN_SETUP | USE_PAGER },\n+\t{ \"write-tree\", cmd_write_tree, RUN_SETUP },\n+\t{ \"verify-pack\", cmd_verify_pack },\n+\t{ \"show-ref\", cmd_show_ref, RUN_SETUP },\n+\t{ \"pack-refs\", cmd_pack_refs, RUN_SETUP },\n+};\n+\n static void handle_internal_command(int argc, const char **argv)\n {\n \tconst char *cmd = argv[0];\n-\tstatic struct cmd_struct commands[] = {\n-\t\t{ \"add\", cmd_add, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"annotate\", cmd_annotate, RUN_SETUP },\n-\t\t{ \"apply\", cmd_apply },\n-\t\t{ \"archive\", cmd_archive },\n-\t\t{ \"blame\", cmd_blame, RUN_SETUP },\n-\t\t{ \"branch\", cmd_branch, RUN_SETUP },\n-\t\t{ \"bundle\", cmd_bundle },\n-\t\t{ \"cat-file\", cmd_cat_file, RUN_SETUP },\n-\t\t{ \"checkout\", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"checkout-index\", cmd_checkout_index,\n-\t\t\tRUN_SETUP | NEED_WORK_TREE},\n-\t\t{ \"check-ref-format\", cmd_check_ref_format },\n-\t\t{ \"check-attr\", cmd_check_attr, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"cherry\", cmd_cherry, RUN_SETUP },\n-\t\t{ \"cherry-pick\", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"clean\", cmd_clean, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"commit\", cmd_commit, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"commit-tree\", cmd_commit_tree, RUN_SETUP },\n-\t\t{ \"config\", cmd_config },\n-\t\t{ \"count-objects\", cmd_count_objects, RUN_SETUP },\n-\t\t{ \"describe\", cmd_describe, RUN_SETUP },\n-\t\t{ \"diff\", cmd_diff },\n-\t\t{ \"diff-files\", cmd_diff_files },\n-\t\t{ \"diff-index\", cmd_diff_index, RUN_SETUP },\n-\t\t{ \"diff-tree\", cmd_diff_tree, RUN_SETUP },\n-\t\t{ \"fast-export\", cmd_fast_export, RUN_SETUP },\n-\t\t{ \"fetch\", cmd_fetch, RUN_SETUP },\n-\t\t{ \"fetch-pack\", cmd_fetch_pack, RUN_SETUP },\n-\t\t{ \"fetch--tool\", cmd_fetch__tool, RUN_SETUP },\n-\t\t{ \"fmt-merge-msg\", cmd_fmt_merge_msg, RUN_SETUP },\n-\t\t{ \"for-each-ref\", cmd_for_each_ref, RUN_SETUP },\n-\t\t{ \"format-patch\", cmd_format_patch, RUN_SETUP },\n-\t\t{ \"fsck\", cmd_fsck, RUN_SETUP },\n-\t\t{ \"fsck-objects\", cmd_fsck, RUN_SETUP },\n-\t\t{ \"gc\", cmd_gc, RUN_SETUP },\n-\t\t{ \"get-tar-commit-id\", cmd_get_tar_commit_id },\n-\t\t{ \"grep\", cmd_grep, RUN_SETUP | USE_PAGER },\n-\t\t{ \"help\", cmd_help },\n-#ifndef NO_CURL\n-\t\t{ \"http-fetch\", cmd_http_fetch, RUN_SETUP },\n-#endif\n-\t\t{ \"init\", cmd_init_db },\n-\t\t{ \"init-db\", cmd_init_db },\n-\t\t{ \"log\", cmd_log, RUN_SETUP | USE_PAGER },\n-\t\t{ \"ls-files\", cmd_ls_files, RUN_SETUP },\n-\t\t{ \"ls-tree\", cmd_ls_tree, RUN_SETUP },\n-\t\t{ \"ls-remote\", cmd_ls_remote },\n-\t\t{ \"mailinfo\", cmd_mailinfo },\n-\t\t{ \"mailsplit\", cmd_mailsplit },\n-\t\t{ \"merge-base\", cmd_merge_base, RUN_SETUP },\n-\t\t{ \"merge-file\", cmd_merge_file },\n-\t\t{ \"merge-ours\", cmd_merge_ours, RUN_SETUP },\n-\t\t{ \"merge-recursive\", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"merge-subtree\", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"mv\", cmd_mv, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"name-rev\", cmd_name_rev, RUN_SETUP },\n-\t\t{ \"pack-objects\", cmd_pack_objects, RUN_SETUP },\n-\t\t{ \"peek-remote\", cmd_ls_remote },\n-\t\t{ \"pickaxe\", cmd_blame, RUN_SETUP },\n-\t\t{ \"prune\", cmd_prune, RUN_SETUP },\n-\t\t{ \"prune-packed\", cmd_prune_packed, RUN_SETUP },\n-\t\t{ \"push\", cmd_push, RUN_SETUP },\n-\t\t{ \"read-tree\", cmd_read_tree, RUN_SETUP },\n-\t\t{ \"reflog\", cmd_reflog, RUN_SETUP },\n-\t\t{ \"remote\", cmd_remote, RUN_SETUP },\n-\t\t{ \"repo-config\", cmd_config },\n-\t\t{ \"rerere\", cmd_rerere, RUN_SETUP },\n-\t\t{ \"reset\", cmd_reset, RUN_SETUP },\n-\t\t{ \"rev-list\", cmd_rev_list, RUN_SETUP },\n-\t\t{ \"rev-parse\", cmd_rev_parse },\n-\t\t{ \"revert\", cmd_revert, RUN_SETUP | NEED_WORK_TREE },\n-\t\t{ \"rm\", cmd_rm, RUN_SETUP },\n-\t\t{ \"send-pack\", cmd_send_pack, RUN_SETUP },\n-\t\t{ \"shortlog\", cmd_shortlog, USE_PAGER },\n-\t\t{ \"show-branch\", cmd_show_branch, RUN_SETUP },\n-\t\t{ \"show\", cmd_show, RUN_SETUP | USE_PAGER },\n-\t\t{ \"status\", cmd_status, RUN_SETUP | NEED_WORK_TREE | USE_PAGER },\n-\t\t{ \"stripspace\", cmd_stripspace },\n-\t\t{ \"symbolic-ref\", cmd_symbolic_ref, RUN_SETUP },\n-\t\t{ \"tag\", cmd_tag, RUN_SETUP },\n-\t\t{ \"tar-tree\", cmd_tar_tree },\n-\t\t{ \"unpack-objects\", cmd_unpack_objects, RUN_SETUP },\n-\t\t{ \"update-index\", cmd_update_index, RUN_SETUP },\n-\t\t{ \"update-ref\", cmd_update_ref, RUN_SETUP },\n-\t\t{ \"upload-archive\", cmd_upload_archive },\n-\t\t{ \"verify-tag\", cmd_verify_tag, RUN_SETUP },\n-\t\t{ \"version\", cmd_version },\n-\t\t{ \"whatchanged\", cmd_whatchanged, RUN_SETUP | USE_PAGER },\n-\t\t{ \"write-tree\", cmd_write_tree, RUN_SETUP },\n-\t\t{ \"verify-pack\", cmd_verify_pack },\n-\t\t{ \"show-ref\", cmd_show_ref, RUN_SETUP },\n-\t\t{ \"pack-refs\", cmd_pack_refs, RUN_SETUP },\n-\t};\n \tint i;\n \n \t/* Turn \"git cmd --help\" into \"git help cmd\" */\n@@ -380,6 +383,31 @@ static void handle_internal_command(int argc, const char **argv)\n \t}\n }\n \n+void set_command_pager(const char *cmd, int use_pager)\n+{\n+\tint i;\n+\tfor (i = 0; i < ARRAY_SIZE(commands); i++) {\n+\t\tstruct cmd_struct *p = commands+i;\n+\t\tif (!strcmp(p->cmd, cmd)) {\n+\t\t\tif (use_pager)\n+\t\t\t\tp->option |= USE_PAGER;\n+\t\t\telse\n+\t\t\t\tp->option &= ~USE_PAGER;\n+\t\t\treturn;\n+\t\t}\n+\t}\n+}\n+\n+int git_wrapper_config(const char *var, const char *value)\n+{\n+\tif (!prefixcmp(var, \"pager.\")) {\n+\t\tset_command_pager(var + 6, git_config_bool(var, value));\n+\t\treturn 0;\n+\t}\n+\n+\treturn 0;\n+}\n+\n int main(int argc, const char **argv)\n {\n \tconst char *cmd = argv[0] ? argv[0] : \"git-help\";\n"},{"id":"75806","messageId":"20080502061108.GA1052@sigill.intra.peff.net","threadId":"13351","inReplyTo":"7vlk2txn8n.fsf@gitster.siamese.dyndns.org","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T06:11:08Z","receivedAt":"2008-05-02T06:11:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 01, 2008 at 10:56:40PM -0700, Junio C Hamano wrote:\n\n> I do not care either way.  As I do not have LESS defined in my environment\n> (which makes git use its built-in that contains FX), I actually never\n> noticed the difference before or after that patch.\n\nI actually like the screen-clearing after-effect, but obviously \"F\" is\nuseless without \"X\".\n\n> Hmmm, I thought I heard you cheered on that patch?  Perhaps it was\n> somebody else.\n\nDefinitely not me. I think it was Dscho.\n\n-Peff\n"},{"id":"75807","messageId":"7vd4o5xm62.fsf@gitster.siamese.dyndns.org","threadId":"13351","inReplyTo":"20080502060930.GA1079@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-02T06:19:49Z","receivedAt":"2008-05-02T06:19:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> @@ -267,103 +270,103 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)\n>  \treturn 0;\n>  }\n>  \n> +static struct cmd_struct commands[] = {\n> +\t{ \"add\", cmd_add, RUN_SETUP | NEED_WORK_TREE },\n> +\t{ \"annotate\", cmd_annotate, RUN_SETUP },\n> +\t{ \"apply\", cmd_apply },\n> +\t{ \"archive\", cmd_archive },\n> +\t{ \"blame\", cmd_blame, RUN_SETUP },\n> +\t{ \"branch\", cmd_branch, RUN_SETUP },\n> +\t{ \"bundle\", cmd_bundle },\n> +\t{ \"cat-file\", cmd_cat_file, RUN_SETUP },\n...\n> +};\n> ...\n> @@ -380,6 +383,31 @@ static void handle_internal_command(int argc, const char **argv)\n>  \t}\n>  }\n>  \n> +void set_command_pager(const char *cmd, int use_pager)\n> +{\n> +\tint i;\n> +\tfor (i = 0; i < ARRAY_SIZE(commands); i++) {\n> +\t\tstruct cmd_struct *p = commands+i;\n> +\t\tif (!strcmp(p->cmd, cmd)) {\n> +\t\t\tif (use_pager)\n> +\t\t\t\tp->option |= USE_PAGER;\n> +\t\t\telse\n> +\t\t\t\tp->option &= ~USE_PAGER;\n> +\t\t\treturn;\n> +\t\t}\n> +\t}\n> +}\n\nHeh, I like it.  I briefly thought that pager.cat-file may wreak havoc on\nscripts, but our pager machanism should be clever enough not to, and\ncat-file is a valid variable name in the configuration file format ;-).\n"},{"id":"75808","messageId":"m3d4o56vlv.fsf@localhost.localdomain","threadId":"13351","inReplyTo":"20080502060930.GA1079@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-05-02T06:56:15Z","receivedAt":"2008-05-02T06:56:15Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, May 02, 2008 at 01:45:08AM -0400, Jeff King wrote:\n> \n> > I agree with you; I don't like it at all. Probably whether or not to use\n> > a pager for a given command should be controlled by a \"pager.<cmd>\"\n> > config variable.\n> \n> Here is a quick and dirty patch to do that. It should probably be split\n> into two (there is a big code movement of the commands array), and it\n> needs documentation and tests. But I'm going to sleep for now.\n\nYou should then accept pager.core (or pager.ui) as alias to existing\ncore.pager configuration variable... well, perhaps you did that...\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"75810","messageId":"alpine.DEB.1.00.0805020851250.2691@eeepc-johanness","threadId":"13351","inReplyTo":"20080502061108.GA1052@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-02T07:53:40Z","receivedAt":"2008-05-02T07:53:40Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 2 May 2008, Jeff King wrote:\n\n> On Thu, May 01, 2008 at 10:56:40PM -0700, Junio C Hamano wrote:\n> \n> > Hmmm, I thought I heard you cheered on that patch?  Perhaps it was \n> > somebody else.\n> \n> Definitely not me. I think it was Dscho.\n\nYep.\n\nI find it amazingly useful to see the first part, you know, the part with \nthe staged changes, instead of them whizzing by and me only seeing the \nlast part of the untracked files.  And of course, I do not even see the \nlabel \"Untracked files:\", because there are so many.\n\nI agree, though, that the paging only makes sense with FSRX (not only \nFX!), and that \"less\" should have that as default, too.\n\nCiao,\nDscho\n"},{"id":"75817","messageId":"702ACF8F-B6D0-42FD-9B38-7C5A4F775E90@simplicidade.org","threadId":"13351","inReplyTo":"8C3474E2-3A4F-44E8-B301-C36939C7BA11@sb.org","subject":"Re: To page or not to page","fromName":"Pedro Melo","fromEmail":"melo@simplicidade.org","sentAt":"2008-05-02T09:41:42Z","receivedAt":"2008-05-02T09:41:42Z","isPatch":false,"sender":{"key":"melo@simplicidade.org","avatar":"https://gravatar.com/avatar/13ddbb01e300285a93aa1e3739653a81f9b1d3438bd03a4ac36b88e4ffeeafc3?d=mp&s=160"},"body":"\nOn May 2, 2008, at 7:04 AM, Kevin Ballard wrote:\n\n> On May 2, 2008, at 1:56 AM, Junio C Hamano wrote:\n>\n>> Jeff King <peff@peff.net> writes:\n>>\n>>> On Fri, May 02, 2008 at 01:41:05AM -0400, Kevin Ballard wrote:\n>>>\n>>>> Does anybody have any comments or opinions about this either way?\n>>>\n>>> I agree with you; I don't like it at all.\n>>\n>> I do not care either way.  As I do not have LESS defined in my  \n>> environment\n>> (which makes git use its built-in that contains FX), I actually never\n>> noticed the difference before or after that patch.\n>\n> Even if I put FX into LESS (I have it set normally so it contains  \n> R), it still doesn't behave correctly. I compulsively clear my  \n> terminal screen whenever I don't need the current contents, but  \n> with FX in LESS, `git status` throws the output at the bottom of my  \n> terminal, leaving a lot of blank space at the top. This is  \n> extremely irritating to me.\n\nhmms... I remember you being a Mac user. I'm on 10.4.11 and with\n\nLESS=iFMRSXW\nLESSCHARSET=utf-8\n\nit works as if no pager has been set.\n\nPersonally, I like the pager because the best part of git-status is  \nat the top, so if I hit git-status thats the one I want to see.\n\nBest regards,\n-- \nPedro Melo\nBlog: http://www.simplicidade.org/notes/\nXMPP ID: melo@simplicidade.org\nUse XMPP!\n"},{"id":"75821","messageId":"807E185B-BEE5-4AAF-8DF4-EE597681D61C@wincent.com","threadId":"13351","inReplyTo":"8C3474E2-3A4F-44E8-B301-C36939C7BA11@sb.org","subject":"Re: To page or not to page","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-05-02T10:34:10Z","receivedAt":"2008-05-02T10:34:10Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 2/5/2008, a las 8:04, Kevin Ballard escribió:\n\n> Is there any good reason to make git-status use the pager? The  \n> output is very rarely long enough to warrant it, and if I need a  \n> pager I can always just pipe it to less myself.\n\nI for one welcome this change and often have status output that is  \nlong enough to warrant using a pager. I am constantly seeing more than  \na full screen of results and then either re-running the command as  \n\"git -p status\" or otherwise scrolling upwards to see the part of the  \nstatus output that is actually interesting to me. It has often annoyed  \nme that commands like \"git log\" have always given me a highly usable  \ndefault behaviour \"out of the box\" (one of the first things I noticed  \nabout Git when I started using it that made me think, \"ah, that's a  \nnice touch\") while \"git status\" didn't.\n\nBut evidently given that there has been so much backlash against the  \npatch the only way to keep everyone happy will be to make this  \nconfigurable.\n\nCheers,\nWincent\n"},{"id":"75826","messageId":"20080502123656.GA2680@sigill.intra.peff.net","threadId":"13351","inReplyTo":"807E185B-BEE5-4AAF-8DF4-EE597681D61C@wincent.com","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T12:36:56Z","receivedAt":"2008-05-02T12:36:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 12:34:10PM +0200, Wincent Colaiuta wrote:\n\n> But evidently given that there has been so much backlash against the  \n> patch the only way to keep everyone happy will be to make this  \n> configurable.\n\nAgreed.\n\nBut I wonder why there seems to be such a split between people who\nclearly have short git-status output, and those who have long git-status\noutput.\n\nI keep my \"untracked files\" list tidy. IOW, I always get:\n\n  $ git status\n  # On branch master\n  nothing to commit (working directory clean)\n\nand if I don't, then I should be taking some action to commit things,\nclean them up, or add them to my .git/info/exclude file. Do other people\ngenerally carry around a lot of cruft that \"git status\" reports?\n\n-Peff\n"},{"id":"75828","messageId":"20080502125553.GB2923@sigill.intra.peff.net","threadId":"13351","inReplyTo":"7vd4o5xm62.fsf@gitster.siamese.dyndns.org","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T12:55:54Z","receivedAt":"2008-05-02T12:55:54Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 01, 2008 at 11:19:49PM -0700, Junio C Hamano wrote:\n\n> Heh, I like it.  I briefly thought that pager.cat-file may wreak havoc on\n> scripts, but our pager machanism should be clever enough not to, and\n> cat-file is a valid variable name in the configuration file format ;-).\n\nYes, I sort of assumed that the pager \"auto\" setting would take care of\nmost things. I guess somebody could be crazy enough to set pager to\n\"always\" and pager.mailinfo to \"true\", but I'm not sure that's worth\navoiding.\n\nMy bigger worry is that this affects only builtins. Which makes it\nsufficient for turning off the pager for anything that does USE_PAGER.\nBut you can't turn _on_ the pager for arbitrary commands (e.g.,\npager.pull would be ignored). And some commands use pagers from\nsub-commands; e.g., git-stash calls git-diff to show a stash; so turning\noff the pager entails setting pager.diff, with no way to differentiate\nbetween stash and regular diff.\n\nSo it would be inconsistent and expose implementation details. But maybe\nthat is OK for now, and we just say \"well, everything will become a\nbuiltin eventually.\" ;)\n\n-Peff\n"},{"id":"75831","messageId":"20080502125755.GC2923@sigill.intra.peff.net","threadId":"13351","inReplyTo":"m3d4o56vlv.fsf@localhost.localdomain","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T12:57:55Z","receivedAt":"2008-05-02T12:57:55Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 01, 2008 at 11:56:15PM -0700, Jakub Narebski wrote:\n\n> > Here is a quick and dirty patch to do that. It should probably be split\n> > into two (there is a big code movement of the commands array), and it\n> > needs documentation and tests. But I'm going to sleep for now.\n> \n> You should then accept pager.core (or pager.ui) as alias to existing\n> core.pager configuration variable... well, perhaps you did that...\n\nWhy? I am claiming the pager.* namespace for turning the pager off and\non for specific commands, which neither of those do (the exception is\nthe historic pager.color, which would still work).\n\nIf you want to argue that all pager options should be consolidated under\npager.*, I think that is a totally separate issue (and one which my\npatch argues against, since it could lead to name collisions).\n\n-Peff\n"},{"id":"75841","messageId":"20080502134725.GJ32313@jukie.net","threadId":"13351","inReplyTo":"7vhcdhxmpr.fsf@gitster.siamese.dyndns.org","subject":"Re: To page or not to page","fromName":"Bart Trojanowski","fromEmail":"bart@jukie.net","sentAt":"2008-05-02T13:47:25Z","receivedAt":"2008-05-02T13:47:25Z","isPatch":false,"sender":{"key":"bart@jukie.net","avatar":"https://avatars.githubusercontent.com/u/6721?v=4"},"body":"* Junio C Hamano <gitster@pobox.com> [080502 02:03]:\n> Kevin Ballard <kevin@sb.org> writes:\n> \n> > Is there any good reason to make git-status use the pager? The output\n> > is very rarely long enough to warrant it, and if I need a pager I can\n> > always just pipe it to less myself.\n> \n> I have no motivation to defend that change.  I'll leave that to the\n> original submitter and list archive ;-)\n\nMy goal was to improve consistency with git log and git diff.  \n\n-Bart\n\n-- \n\t\t\t\tWebSig: http://www.jukie.net/~bart/sig/\n"},{"id":"75840","messageId":"3C2FECF0-8765-4988-98B7-4B050F999128@simplicidade.org","threadId":"13351","inReplyTo":"20080502123656.GA2680@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Pedro Melo","fromEmail":"melo@simplicidade.org","sentAt":"2008-05-02T13:49:26Z","receivedAt":"2008-05-02T13:49:26Z","isPatch":false,"sender":{"key":"melo@simplicidade.org","avatar":"https://gravatar.com/avatar/13ddbb01e300285a93aa1e3739653a81f9b1d3438bd03a4ac36b88e4ffeeafc3?d=mp&s=160"},"body":"Hi,\n\nOn May 2, 2008, at 1:36 PM, Jeff King wrote:\n\n> But I wonder why there seems to be such a split between people who\n> clearly have short git-status output, and those who have long git- \n> status\n> output.\n>\n> I keep my \"untracked files\" list tidy. IOW, I always get:\n>\n>   $ git status\n>   # On branch master\n>   nothing to commit (working directory clean)\n>\n> and if I don't, then I should be taking some action to commit things,\n> clean them up, or add them to my .git/info/exclude file. Do other  \n> people\n> generally carry around a lot of cruft that \"git status\" reports?\n\nI tend to accumulate \"screen-and-a-half\" git status outputs.\n\nI usually hack on something until it works, and then I use git-gui  \nand the hunk-based selection to order my work into a sane set of  \ncommits.\n\nCommit'ing more often would make me wander of my task.\n\nI guess its a matter of personal preference.\n\nBest regards,\n-- \nPedro Melo\nBlog: http://www.simplicidade.org/notes/\nXMPP ID: melo@simplicidade.org\nUse XMPP!\n"},{"id":"75844","messageId":"20080502140040.GI18081@yugib.highrise.ca","threadId":"13351","inReplyTo":"20080502123656.GA2680@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Aidan Van Dyk","fromEmail":"aidan@highrise.ca","sentAt":"2008-05-02T14:00:40Z","receivedAt":"2008-05-02T14:00:40Z","isPatch":false,"sender":{"key":"aidan@highrise.ca","avatar":"https://gravatar.com/avatar/853c50d90cce753dc1c390fdc6cbed558f5f969bd43fa4f5cb0118d8f71316f6?d=mp&s=160"},"body":"* Jeff King <peff@peff.net> [080501 00:00]:\n> On Fri, May 02, 2008 at 12:34:10PM +0200, Wincent Colaiuta wrote:\n> \n> > But evidently given that there has been so much backlash against the  \n> > patch the only way to keep everyone happy will be to make this  \n> > configurable.\n> \n> Agreed.\n> \n> But I wonder why there seems to be such a split between people who\n> clearly have short git-status output, and those who have long git-status\n> output.\n> \n> I keep my \"untracked files\" list tidy. IOW, I always get:\n> \n>   $ git status\n>   # On branch master\n>   nothing to commit (working directory clean)\n> \n> and if I don't, then I should be taking some action to commit things,\n> clean them up, or add them to my .git/info/exclude file. Do other people\n> generally carry around a lot of cruft that \"git status\" reports?\n\nI like the change.  I don't usually have long git status output; I\nmanage my .gitignore and $GITDIR/info/exclude religously.  But in\nthose cases, the pager has no affect (LESS=FRSX), so it doesn't bother\nme.\n\nBut sometime I have done something which affects a lot of files.  Either\non purpose, or by accident, and suddenly git status has lots of output.\nAnd I'm usually not thinking git status will have reams of output and\nat that time, I really like *not* having to re-run the command with -p\nor | $PAGER.\n\na.\n\n\n-- \nAidan Van Dyk                                             Create like a god,\naidan@highrise.ca                                       command like a king,\nhttp://www.highrise.ca/                                   work like a slave.\n"},{"id":"75850","messageId":"20080502153628.GA6294@sigill.intra.peff.net","threadId":"13351","inReplyTo":"20080502060930.GA1079@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T15:36:28Z","receivedAt":"2008-05-02T15:36:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 02:09:30AM -0400, Jeff King wrote:\n\n> > I agree with you; I don't like it at all. Probably whether or not to use\n> > a pager for a given command should be controlled by a \"pager.<cmd>\"\n> > config variable.\n> \n> Here is a quick and dirty patch to do that. It should probably be split\n> into two (there is a big code movement of the commands array), and it\n> needs documentation and tests. But I'm going to sleep for now.\n\nHere is a cleaner patch. Rather than looking at all of pager.*, it waits\nuntil we see which command to execute, and just looks up pager.cmd (we\nend up having to parse the config the same number of times). And we\ndon't have to munge the static global commands array, which just feels a\nlittle cleaner.\n\nStill no documentation, and still not a \"real\" patch; I am curious to\nsee the list reaction on the issues I raised elsewhere in the thread\n(like the user-facing inconsistencies).\n\n---\n git.c |   30 +++++++++++++++++++++++++++++-\n 1 files changed, 29 insertions(+), 1 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex 89b431f..68d8b37 100644\n--- a/git.c\n+++ b/git.c\n@@ -230,6 +230,25 @@ struct cmd_struct {\n \tint option;\n };\n \n+static const char *pager_command_key;\n+static int pager_command_value;\n+\n+int pager_command_config(const char *var, const char *value)\n+{\n+\tif (!prefixcmp(var, \"pager.\") && !strcmp(var + 6, pager_command_key))\n+\t\tpager_command_value = git_config_bool(var, value);\n+\treturn 0;\n+}\n+\n+/* returns 0 for \"no pager\", 1 for \"use pager\", and -1 for \"not specified\" */\n+int check_pager_config(const char *cmd)\n+{\n+\tpager_command_key = cmd;\n+\tpager_command_value = -1;\n+\tgit_config(pager_command_config);\n+\treturn pager_command_value;\n+}\n+\n static int run_command(struct cmd_struct *p, int argc, const char **argv)\n {\n \tint status;\n@@ -239,8 +258,17 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)\n \tprefix = NULL;\n \tif (p->option & RUN_SETUP)\n \t\tprefix = setup_git_directory();\n-\tif (p->option & USE_PAGER)\n+\tswitch (check_pager_config(p->cmd)) {\n+\tcase 0:\n+\t\tbreak;\n+\tcase 1:\n \t\tsetup_pager();\n+\t\tbreak;\n+\tdefault:\n+\t\tif (p->option & USE_PAGER)\n+\t\t\tsetup_pager();\n+\t\tbreak;\n+\t}\n \tif (p->option & NEED_WORK_TREE)\n \t\tsetup_work_tree();\n \n-- \n1.5.5.1.221.ga481.dirty\n"},{"id":"75852","messageId":"7D1C3FC4-9FC0-49E5-929C-CDEF5FAD3D02@wincent.com","threadId":"13351","inReplyTo":"20080502123656.GA2680@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-05-02T16:13:38Z","receivedAt":"2008-05-02T16:13:38Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 2/5/2008, a las 14:36, Jeff King escribió:\n> On Fri, May 02, 2008 at 12:34:10PM +0200, Wincent Colaiuta wrote:\n>\n>> But evidently given that there has been so much backlash against the\n>> patch the only way to keep everyone happy will be to make this\n>> configurable.\n>\n> Agreed.\n>\n> But I wonder why there seems to be such a split between people who\n> clearly have short git-status output, and those who have long git- \n> status\n> output.\n\nI generally try to work on one thing at a time and keep the status  \noutput short -- and I imagine that that's the way most people work --  \nbut there are certain things where long output is going to be  \nunavoidable, like renaming a directory with lots of files in it. And  \nwhen that happens, seeing only the bottom of the \"git status\" output  \nand not the top is not what I want 100% of the time.\n\nCheers,\nWincent\n"},{"id":"75853","messageId":"247FB870-E42E-4FFA-B230-8A377748C731@sb.org","threadId":"13351","inReplyTo":"7D1C3FC4-9FC0-49E5-929C-CDEF5FAD3D02@wincent.com","subject":"Re: To page or not to page","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2008-05-02T16:56:46Z","receivedAt":"2008-05-02T16:56:46Z","isPatch":false,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On May 2, 2008, at 12:13 PM, Wincent Colaiuta wrote:\n\n> El 2/5/2008, a las 14:36, Jeff King escribió:\n>> On Fri, May 02, 2008 at 12:34:10PM +0200, Wincent Colaiuta wrote:\n>>\n>>> But evidently given that there has been so much backlash against the\n>>> patch the only way to keep everyone happy will be to make this\n>>> configurable.\n>>\n>> Agreed.\n>>\n>> But I wonder why there seems to be such a split between people who\n>> clearly have short git-status output, and those who have long git- \n>> status\n>> output.\n>\n> I generally try to work on one thing at a time and keep the status  \n> output short -- and I imagine that that's the way most people work  \n> -- but there are certain things where long output is going to be  \n> unavoidable, like renaming a directory with lots of files in it. And  \n> when that happens, seeing only the bottom of the \"git status\" output  \n> and not the top is not what I want 100% of the time.\n\nDoesn't your terminal have the ability to scroll? If my git-status  \noutput is longer than my terminal's height, I just hit Page Up to see  \nthe top.\n\n-Kevin\n\n-- \nKevin Ballard\nhttp://kevin.sb.org\nkevin@sb.org\nhttp://www.tildesoft.com\n"},{"id":"75854","messageId":"2161C3E5-69E8-4160-8468-43E8B1049746@sb.org","threadId":"13351","inReplyTo":"702ACF8F-B6D0-42FD-9B38-7C5A4F775E90@simplicidade.org","subject":"Re: To page or not to page","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2008-05-02T16:58:25Z","receivedAt":"2008-05-02T16:58:25Z","isPatch":false,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On May 2, 2008, at 5:41 AM, Pedro Melo wrote:\n\n>> Even if I put FX into LESS (I have it set normally so it contains  \n>> R), it still doesn't behave correctly. I compulsively clear my  \n>> terminal screen whenever I don't need the current contents, but  \n>> with FX in LESS, `git status` throws the output at the bottom of my  \n>> terminal, leaving a lot of blank space at the top. This is  \n>> extremely irritating to me.\n>\n> hmms... I remember you being a Mac user. I'm on 10.4.11 and with\n>\n> LESS=iFMRSXW\n> LESSCHARSET=utf-8\n>\n> it works as if no pager has been set.\n\nExcept that's not true. As I've mentioned before, if I've cleared the  \nterminal, and I run less with FX set, and the output is less than the  \nheight of my terminal, all the output ends up at the bottom of my  \nterminal and the rest of the terminal is blank space. It's rather  \nannoying, because it's the exact opposite of how I usually work (I  \ncompulsively clear my terminal so I can work at the top of the window  \ninstead of the bottom).\n\n-Kevin\n\n-- \nKevin Ballard\nhttp://kevin.sb.org\nkevin@sb.org\nhttp://www.tildesoft.com\n"},{"id":"75858","messageId":"7v1w4ky3hh.fsf@gitster.siamese.dyndns.org","threadId":"13351","inReplyTo":"20080502125553.GB2923@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-02T18:18:02Z","receivedAt":"2008-05-02T18:18:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> My bigger worry is that this affects only builtins. Which makes it\n> sufficient for turning off the pager for anything that does USE_PAGER.\n\nHmm. How about doing things this way?\n\n - at the beginning of handle_options() remember argv[0]\n\n - restructure handle_options() so that it does not run setup_pager() and\n   setenv(\"GIT_PAGER\", \"cat\", 1) inside the loop, but instead remember\n   what we had on the command line;\n\n - after the handle_options() loop, if we saw an explicit --pager,\n   --no-pager, that's the decision;\n\n - otherwise:\n\n   - look at argv[0] to see what the command is;\n\n   - do the config thing to see if there is user preference; if there is\n     one, that setting decides;\n\n   - otherwise:\n\n     - see the built-in defaults;\n\n - and finally use or not use pager depending on what we found above.\n\nI suspect we would want a similar restructure of handle_options() loop\nabout --git-dir and --git-work-tree so that the loop is only used to\ndecide what to do and action is carried out after the loop exits, but that\nis a separate topic.\n"},{"id":"75862","messageId":"15C1122F-B6BA-4599-A40C-181D131CD252@wincent.com","threadId":"13351","inReplyTo":"247FB870-E42E-4FFA-B230-8A377748C731@sb.org","subject":"Re: To page or not to page","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-05-02T18:40:40Z","receivedAt":"2008-05-02T18:40:40Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 2/5/2008, a las 18:56, Kevin Ballard escribió:\n> On May 2, 2008, at 12:13 PM, Wincent Colaiuta wrote:\n>\n>> El 2/5/2008, a las 14:36, Jeff King escribió:\n>>> On Fri, May 02, 2008 at 12:34:10PM +0200, Wincent Colaiuta wrote:\n>>>\n>>>> But evidently given that there has been so much backlash against  \n>>>> the\n>>>> patch the only way to keep everyone happy will be to make this\n>>>> configurable.\n>>>\n>>> Agreed.\n>>>\n>>> But I wonder why there seems to be such a split between people who\n>>> clearly have short git-status output, and those who have long git- \n>>> status\n>>> output.\n>>\n>> I generally try to work on one thing at a time and keep the status  \n>> output short -- and I imagine that that's the way most people work  \n>> -- but there are certain things where long output is going to be  \n>> unavoidable, like renaming a directory with lots of files in it.  \n>> And when that happens, seeing only the bottom of the \"git status\"  \n>> output and not the top is not what I want 100% of the time.\n>\n> Doesn't your terminal have the ability to scroll? If my git-status  \n> output is longer than my terminal's height, I just hit Page Up to  \n> see the top.\n\nOf course it does, but page up won't necessarily take me to the top of  \nthe \"git status\" output; usually it takes me to somewhere before it or  \nsomewhere after it.\n\nWincent\n"},{"id":"76153","messageId":"20080505215924.GA9228@sigill.intra.peff.net","threadId":"13351","inReplyTo":"7v1w4ky3hh.fsf@gitster.siamese.dyndns.org","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-05T21:59:25Z","receivedAt":"2008-05-05T21:59:25Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 11:18:02AM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > My bigger worry is that this affects only builtins. Which makes it\n> > sufficient for turning off the pager for anything that does USE_PAGER.\n> \n> Hmm. How about doing things this way?\n> \n>  - at the beginning of handle_options() remember argv[0]\n> \n>  - restructure handle_options() so that it does not run setup_pager() and\n>    setenv(\"GIT_PAGER\", \"cat\", 1) inside the loop, but instead remember\n>    what we had on the command line;\n> \n>  - after the handle_options() loop, if we saw an explicit --pager,\n>    --no-pager, that's the decision;\n> \n>  - otherwise:\n> \n>    - look at argv[0] to see what the command is;\n> \n>    - do the config thing to see if there is user preference; if there is\n>      one, that setting decides;\n> \n>    - otherwise:\n> \n>      - see the built-in defaults;\n> \n>  - and finally use or not use pager depending on what we found above.\n\nOK, that makes some sense. I think some of what you describe is just\nrefactoring (e.g., it doesn't matter if we actually do things when we\nsee --no-pager or afterwards, since it always takes precedence). The key\nthings are:\n\n  - work not just on running builtins, but before we even figure out\n    whether we have a builtin or a script\n\n  - in my patch the config just says \"ignore the default USE_PAGER\", but\n    it really should be \"turn off the pager via GIT_PAGER=cat\". That way\n    you can say pager.stash = false, and it will impact the git-diff\n    invocation run by stash.\n\nBut that isn't to say the refactoring isn't worth doing to keep things\nclean. I will take a stab at restructuring it the way you specified.\n\nThere is one remaining annoyance, though: this code is only run via the\ngit wrapper. That means that you will get different behavior for\n\"git-stash\" versus \"git stash\". To make that work, we would have to put\nequivalent support into each script (although we could hit several at\nonce with git-sh-setup.sh) and each non-builtin.\n\n-Peff\n"},{"id":"76174","messageId":"20080506055128.GA26311@sigill.intra.peff.net","threadId":"13351","inReplyTo":"7v1w4ky3hh.fsf@gitster.siamese.dyndns.org","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-06T05:51:28Z","receivedAt":"2008-05-06T05:51:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 11:18:02AM -0700, Junio C Hamano wrote:\n\n> Hmm. How about doing things this way?\n> \n>  - at the beginning of handle_options() remember argv[0]\n> \n>  - restructure handle_options() so that it does not run setup_pager() and\n>    setenv(\"GIT_PAGER\", \"cat\", 1) inside the loop, but instead remember\n>    what we had on the command line;\n> \n>  - after the handle_options() loop, if we saw an explicit --pager,\n>    --no-pager, that's the decision;\n\nThis is actually a bit tricky, since there are two code paths; builtins\ncalled as git-foo never even go to handle_options, but they can still\nlook up the config value.\n\nSo how about this:\n\n - keep a global use_pager = { 0 (explicit no), 1 (explicit yes), -1\n   (unknown) }\n\n - if git-foo, lookup config for pager.foo\n\n - otherwise we have \"git [options] foo\"; look for -p / --no-pager; if\n   none found, then lookup config for \"foo\"\n\n - before proceeding further, \"commit\" the pager choice by running it\n   (if 1), munging GIT_PAGER=cat (if 0), or doing nothing (if -1)\n\n - before handling an internal command, if use_pager is -1 and the\n   command defaults to a pager, we run it then\n\nThe patch below implements this.\n\nIt would be nice to actually defer running the pager until we are about\nto run a git command. I.e., never \"commit\" to the pager until we are\nactually running an internal command or exec'ing an external command.\nThat way it would be safe to make an alias that called \"--no-pager\"\n(which is currently disallowed).\n\nThat works for internal commands, since we know we are going to run one,\nand if it fails, we die.  However, for external commands, we just exec\nand hope it works. So if we run the pager beforehand, we are now\ncommitted to it, and a further alias cannot set --no-pager. We could\nalternatively run it after deciding that running the command is what\nwe'll do, but then we have to do the PATH lookup ourselves.\n\nSo anyway, here is the less invasive version.\n\n---\n git.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----\n 1 files changed, 44 insertions(+), 4 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex 89b431f..dadca41 100644\n--- a/git.c\n+++ b/git.c\n@@ -6,12 +6,46 @@\n const char git_usage_string[] =\n \t\"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]\";\n \n+static int use_pager = -1;\n+static const char *pager_command_key;\n+static int pager_command_value;\n+\n+int pager_command_config(const char *var, const char *value)\n+{\n+\tif (!prefixcmp(var, \"pager.\") && !strcmp(var + 6, pager_command_key))\n+\t\tpager_command_value = git_config_bool(var, value);\n+\treturn 0;\n+}\n+\n+/* returns 0 for \"no pager\", 1 for \"use pager\", and -1 for \"not specified\" */\n+int check_pager_config(const char *cmd)\n+{\n+\tpager_command_key = cmd;\n+\tpager_command_value = -1;\n+\tgit_config(pager_command_config);\n+\treturn pager_command_value;\n+}\n+\n+static void commit_pager_choice(void) {\n+\tswitch (use_pager) {\n+\tcase 0:\n+\t\tsetenv(\"GIT_PAGER\", \"cat\", 1);\n+\t\tbreak;\n+\tcase 1:\n+\t\tsetup_pager();\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+}\n+\n static int handle_options(const char*** argv, int* argc, int* envchanged)\n {\n \tint handled = 0;\n+\tconst char *cmd = NULL;\n \n \twhile (*argc > 0) {\n-\t\tconst char *cmd = (*argv)[0];\n+\t\tcmd = (*argv)[0];\n \t\tif (cmd[0] != '-')\n \t\t\tbreak;\n \n@@ -35,9 +69,9 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)\n \t\t\t\texit(0);\n \t\t\t}\n \t\t} else if (!strcmp(cmd, \"-p\") || !strcmp(cmd, \"--paginate\")) {\n-\t\t\tsetup_pager();\n+\t\t\tuse_pager = 1;\n \t\t} else if (!strcmp(cmd, \"--no-pager\")) {\n-\t\t\tsetenv(\"GIT_PAGER\", \"cat\", 1);\n+\t\t\tuse_pager = 0;\n \t\t\tif (envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--git-dir\")) {\n@@ -84,6 +118,9 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)\n \t\t(*argc)--;\n \t\thandled++;\n \t}\n+\n+\tif (use_pager == -1 && cmd)\n+\t\tuse_pager = check_pager_config(cmd);\n \treturn handled;\n }\n \n@@ -239,7 +276,7 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)\n \tprefix = NULL;\n \tif (p->option & RUN_SETUP)\n \t\tprefix = setup_git_directory();\n-\tif (p->option & USE_PAGER)\n+\tif (use_pager == -1 && p->option & USE_PAGER)\n \t\tsetup_pager();\n \tif (p->option & NEED_WORK_TREE)\n \t\tsetup_work_tree();\n@@ -411,6 +448,8 @@ int main(int argc, const char **argv)\n \tif (!prefixcmp(cmd, \"git-\")) {\n \t\tcmd += 4;\n \t\targv[0] = cmd;\n+\t\tuse_pager = check_pager_config(cmd);\n+\t\tcommit_pager_choice();\n \t\thandle_internal_command(argc, argv);\n \t\tdie(\"cannot handle %s internally\", cmd);\n \t}\n@@ -419,6 +458,7 @@ int main(int argc, const char **argv)\n \targv++;\n \targc--;\n \thandle_options(&argv, &argc, NULL);\n+\tcommit_pager_choice();\n \tif (argc > 0) {\n \t\tif (!prefixcmp(argv[0], \"--\"))\n \t\t\targv[0] += 2;\n-- \n1.5.5.1.244.g148a.dirty\n"},{"id":"76175","messageId":"20080506055344.GA26409@sigill.intra.peff.net","threadId":"13351","inReplyTo":"20080506055128.GA26311@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-06T05:53:45Z","receivedAt":"2008-05-06T05:53:45Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, May 06, 2008 at 01:51:28AM -0400, Jeff King wrote:\n\n> So anyway, here is the less invasive version.\n> \n> ---\n>  git.c |   48 ++++++++++++++++++++++++++++++++++++++++++++----\n>  1 files changed, 44 insertions(+), 4 deletions(-)\n\nNB: this of course works only for git-* that is a builtin, and does\nnothing for an external \"git-foo\" (of course it does work for \"git foo\"\nin that case).\n\nWe need to decide if that is a showstopper, or if it is OK for that\ninconsistency to live (I don't think manually fixing all such git-foo is\npossible, since they could be user scripts).\n\n-Peff\n"},{"id":"76642","messageId":"7vhcd469tw.fsf@gitster.siamese.dyndns.org","threadId":"13351","inReplyTo":"20080506055128.GA26311@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Junio C Hamano","fromEmail":"junio@pobox.com","sentAt":"2008-05-11T17:15:39Z","receivedAt":"2008-05-11T17:15:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> So how about this:\n>\n>  - keep a global use_pager = { 0 (explicit no), 1 (explicit yes), -1\n>    (unknown) }\n>\n>  - if git-foo, lookup config for pager.foo\n>\n>  - otherwise we have \"git [options] foo\"; look for -p / --no-pager; if\n>    none found, then lookup config for \"foo\"\n>\n>  - before proceeding further, \"commit\" the pager choice by running it\n>    (if 1), munging GIT_PAGER=cat (if 0), or doing nothing (if -1)\n>\n>  - before handling an internal command, if use_pager is -1 and the\n>    command defaults to a pager, we run it then\n>\n> The patch below implements this.\n>\n> It would be nice to actually defer running the pager until we are about\n> to run a git command. I.e., never \"commit\" to the pager until we are\n> actually running an internal command or exec'ing an external command.\n> That way it would be safe to make an alias that called \"--no-pager\"\n> (which is currently disallowed).\n\nOk, I agree that this is a less nice (as you mention ablve) but a workable\ncompromise with the reality.\n"},{"id":"77098","messageId":"20080516044238.GA6784@sigill.intra.peff.net","threadId":"13351","inReplyTo":"20080506055128.GA26311@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-16T04:42:38Z","receivedAt":"2008-05-16T04:42:38Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, May 06, 2008 at 01:51:28AM -0400, Jeff King wrote:\n\n> So anyway, here is the less invasive version.\n> [of configurable paging]\n\nGah. Lacking any more input, I was going to clean this up and re-submit,\nbut it seems to fail some unrelated tests.\n\nIt appears that with this patch, you can no longer do:\n\n  cd .git && git show HEAD\n\nbecause of some awful ordering constraints in the wrapper. Specifically,\nlooking in the config for pager.* entails calling git_path, which ends\nup calling setup_git_env, which says \"I guess our git_dir is '.git'\".\nWhich is of course totally wrong, and calling setup_git_directory would\nfind the right thing.\n\nSo the logic in setup_git_env seems bogus, but should basically never be\ninvoked because we do generally call setup_git_directory_gently before\nthen. Either it should probably call setup_git_directory_gently (though\nI am afraid of what awful side effects that could have), or it should\njust barf, and people should do setup_git_directory beforehand (and I'm\nsure that will break something too).\n\nBlargh.\n\n-Peff\n"},{"id":"77099","messageId":"20080516045139.GA10858@sigill.intra.peff.net","threadId":"13351","inReplyTo":"20080516044238.GA6784@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-16T04:51:39Z","receivedAt":"2008-05-16T04:51:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 16, 2008 at 12:42:38AM -0400, Jeff King wrote:\n\n> So the logic in setup_git_env seems bogus, but should basically never be\n> invoked because we do generally call setup_git_directory_gently before\n> then. Either it should probably call setup_git_directory_gently (though\n> I am afraid of what awful side effects that could have), or it should\n> just barf, and people should do setup_git_directory beforehand (and I'm\n> sure that will break something too).\n\nHrm. So there are lots of programs that actually _do_ end up needing\nthis lazy load of the git_dir, but it's just that we have\nsetup_git_directory'd ourselves into the top of the work tree by then.\n\nSo it would be nice if we could move that earlier so that the wrapper\ncould do useful things like look at the proper config. But I think that\nopens a whole can of worms with running setup_git_directory twice, IIRC.\n\n-Peff\n"},{"id":"77111","messageId":"alpine.DEB.1.00.0805161129010.30431@racer","threadId":"13351","inReplyTo":"20080516045139.GA10858@sigill.intra.peff.net","subject":"Re: To page or not to page","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-16T10:29:17Z","receivedAt":"2008-05-16T10:29:17Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 16 May 2008, Jeff King wrote:\n\n> On Fri, May 16, 2008 at 12:42:38AM -0400, Jeff King wrote:\n> \n> > So the logic in setup_git_env seems bogus, but should basically never \n> > be invoked because we do generally call setup_git_directory_gently \n> > before then. Either it should probably call setup_git_directory_gently \n> > (though I am afraid of what awful side effects that could have), or it \n> > should just barf, and people should do setup_git_directory beforehand \n> > (and I'm sure that will break something too).\n> \n> Hrm. So there are lots of programs that actually _do_ end up needing \n> this lazy load of the git_dir, but it's just that we have \n> setup_git_directory'd ourselves into the top of the work tree by then.\n> \n> So it would be nice if we could move that earlier so that the wrapper \n> could do useful things like look at the proper config. But I think that \n> opens a whole can of worms with running setup_git_directory twice, IIRC.\n\nYes.  There be dragons.\n\nCiao,\nDscho\n"}]}