{"thread":{"id":"14075","subject":"about c8af1de9 (git status uses pager)","startedAt":"2008-06-21T21:21:27Z","lastAt":"2008-07-03T20:10:34Z","messageCount":21,"participants":["Jan Engelhardt","Vegard Nossum","Junio C Hamano","Johannes Gilger","Jeff King","Dan McGee","Matthieu Moy","Wincent Colaiuta","Tim Stoakes","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"80565","messageId":"alpine.LNX.1.10.0806212319410.22036@fbirervta.pbzchgretzou.qr","threadId":"14075","inReplyTo":null,"subject":"about c8af1de9 (git status uses pager)","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2008-06-21T21:21:27Z","receivedAt":"2008-06-21T21:21:27Z","isPatch":false,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"\nSince git 1.5.6, `git status` always invokes a pager, which is really \nannoying when the output is less than the number of terminal rows \navailable. Can I turn that off somehow or do I need to send a reverting \npatch?\n\n\nJan\n"},{"id":"80567","messageId":"19f34abd0806211430x3d7195d8idc61b7103f899947@mail.gmail.com","threadId":"14075","inReplyTo":"alpine.LNX.1.10.0806212319410.22036@fbirervta.pbzchgretzou.qr","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Vegard Nossum","fromEmail":"vegard.nossum@gmail.com","sentAt":"2008-06-21T21:30:54Z","receivedAt":"2008-06-21T21:30:54Z","isPatch":false,"sender":{"key":"vegard.nossum@gmail.com","avatar":null},"body":"On Sat, Jun 21, 2008 at 11:21 PM, Jan Engelhardt <jengelh@medozas.de> wrote:\n>\n> Since git 1.5.6, `git status` always invokes a pager, which is really\n> annoying when the output is less than the number of terminal rows\n> available. Can I turn that off somehow or do I need to send a reverting\n> patch?\n\nI think it would work to set PAGER=\"less -F\" (a.k.a. --quit-if-one-screen)?\n\nThere's also GIT_PAGER variable, core.pager git setting, etc.\n\n\nVegard\n\n-- \n\"The animistic metaphor of the bug that maliciously sneaked in while\nthe programmer was not looking is intellectually dishonest as it\ndisguises that the error is the programmer's own creation.\"\n\t-- E. W. Dijkstra, EWD1036\n"},{"id":"80569","messageId":"7vzlpe8nyo.fsf@gitster.siamese.dyndns.org","threadId":"14075","inReplyTo":"19f34abd0806211430x3d7195d8idc61b7103f899947@mail.gmail.com","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-21T21:42:07Z","receivedAt":"2008-06-21T21:42:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Vegard Nossum\" <vegard.nossum@gmail.com> writes:\n\n> On Sat, Jun 21, 2008 at 11:21 PM, Jan Engelhardt <jengelh@medozas.de> wrote:\n>>\n>> Since git 1.5.6, `git status` always invokes a pager, which is really\n>> annoying when the output is less than the number of terminal rows\n>> available. Can I turn that off somehow or do I need to send a reverting\n>> patch?\n>\n> I think it would work to set PAGER=\"less -F\" (a.k.a. --quit-if-one-screen)?\n\nProbably better with LESS=FRSX, which is what git uses as a sane default\nif nothing is set.\n"},{"id":"80574","messageId":"20080621214241.GA3839@dualtron.vpn.rwth-aachen.de","threadId":"14075","inReplyTo":"alpine.LNX.1.10.0806212319410.22036@fbirervta.pbzchgretzou.qr","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Johannes Gilger","fromEmail":"heipei@hackvalue.de","sentAt":"2008-06-21T21:42:41Z","receivedAt":"2008-06-21T21:42:41Z","isPatch":false,"sender":{"key":"heipei@hackvalue.de","avatar":"https://avatars.githubusercontent.com/u/6072?v=4"},"body":"On 21/06/08 23:21, Jan Engelhardt wrote:\n> \n> Since git 1.5.6, `git status` always invokes a pager, which is really \n> annoying when the output is less than the number of terminal rows \n> available. Can I turn that off somehow or do I need to send a reverting \n> patch?\n> \n\nWow, I just noticed it myself. Why was that changed? I don't know about \nyour status lines, but I for one find it really annoying. Anything \nthat's in a pager isn't visible in my console afterwards. What's next? \ngit branch in a pager too?\n\nRegards,\nJojo\n\n-- \nJohannes Gilger <heipei@hackvalue.de>\nhttp://hackvalue.de/heipei/\nGPG-Key: 0x42F6DE81\nGPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"80570","messageId":"alpine.LNX.1.10.0806212343560.18093@fbirervta.pbzchgretzou.qr","threadId":"14075","inReplyTo":"7vzlpe8nyo.fsf@gitster.siamese.dyndns.org","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2008-06-21T21:45:46Z","receivedAt":"2008-06-21T21:45:46Z","isPatch":false,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"\nOn Saturday 2008-06-21 23:42, Junio C Hamano wrote:\n\n>\"Vegard Nossum\" <vegard.nossum@gmail.com> writes:\n>\n>> On Sat, Jun 21, 2008 at 11:21 PM, Jan Engelhardt <jengelh@medozas.de> wrote:\n>>>\n>>> Since git 1.5.6, `git status` always invokes a pager, which is really\n>>> annoying when the output is less than the number of terminal rows\n>>> available. Can I turn that off somehow or do I need to send a reverting\n>>> patch?\n>>\n>> I think it would work to set PAGER=\"less -F\" (a.k.a. --quit-if-one-screen)?\n>\n>Probably better with LESS=FRSX, which is what git uses as a sane default\n>if nothing is set.\n>\nI went with Vegard's suggestion to change the pager command in\n~/.gitconfig, since I have the $LESS environment variable already\ndefined as \"-MSi\", and I do not want to change that; because if I am\ngoing to run less (often at the end of a pipe), I certainly do not\nwant it to just quit on me. So -F in $LESS is a no-no.\n\nSince I need \"-MRSi\" for git anyhow, tweaking ~/.gitconfig was easy.\n"},{"id":"80590","messageId":"20080622072420.GA5161@dualtron.vpn.rwth-aachen.de","threadId":"14075","inReplyTo":"20080621214241.GA3839@dualtron.vpn.rwth-aachen.de","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Johannes Gilger","fromEmail":"heipei@hackvalue.de","sentAt":"2008-06-22T07:24:20Z","receivedAt":"2008-06-22T07:24:20Z","isPatch":false,"sender":{"key":"heipei@hackvalue.de","avatar":"https://avatars.githubusercontent.com/u/6072?v=4"},"body":"On 21/06/08 23:42, Johannes Gilger wrote:\n> Wow, I just noticed it myself. Why was that changed? I don't know about \n> your status lines, but I for one find it really annoying. Anything \n> that's in a pager isn't visible in my console afterwards. What's next? \n> git branch in a pager too?\n\nSeems like I got ahead of myself there. After setting the core.pager to \nless -FRSX everything works fine ;)\n\nRegards,\nJojo\n-- \nJohannes Gilger <heipei@hackvalue.de>\nhttp://hackvalue.de/heipei/\nGPG-Key: 0x42F6DE81\nGPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"80595","messageId":"alpine.LNX.1.10.0806221107540.15126@fbirervta.pbzchgretzou.qr","threadId":"14075","inReplyTo":"alpine.LNX.1.10.0806212343560.18093@fbirervta.pbzchgretzou.qr","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2008-06-22T09:09:33Z","receivedAt":"2008-06-22T09:09:33Z","isPatch":false,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"\nOn Saturday 2008-06-21 23:45, Jan Engelhardt wrote:\n>On Saturday 2008-06-21 23:42, Junio C Hamano wrote:\n>>\"Vegard Nossum\" <vegard.nossum@gmail.com> writes:\n>>\n>>> On Sat, Jun 21, 2008 at 11:21 PM, Jan Engelhardt <jengelh@medozas.de> wrote:\n>>>>\n>>>> Since git 1.5.6, `git status` always invokes a pager, which is really\n>>>> annoying when the output is less than the number of terminal rows\n>>>> available. Can I turn that off somehow or do I need to send a reverting\n>>>> patch?\n>>>\n>>> I think it would work to set PAGER=\"less -F\" (a.k.a. --quit-if-one-screen)?\n>>\n>>Probably better with LESS=FRSX, which is what git uses as a sane default\n>>if nothing is set.\n>>\n>I went with Vegard's suggestion to change the pager command in\n>~/.gitconfig, since I have the $LESS environment variable already\n>defined as \"-MSi\", and I do not want to change that; because if I am\n>going to run less (often at the end of a pipe), I certainly do not\n>want it to just quit on me. So -F in $LESS is a no-no.\n>\n>Since I need \"-MRSi\" for git anyhow, tweaking ~/.gitconfig was easy.\n>\nI've played with `less -F` for a while now, and there is an inherent\nproblem with that. Or should I say, xterm.\nWhen less quits, the xterm \"screen\" blits back to the shell output\nthat was previously visible, so\n\tgit status\nwith less -F as a pager displays practically *nothing*.\nI am aware that this is a less / xterm issue, but I wanted to let\nyou know.\n"},{"id":"80596","messageId":"7vtzflolis.fsf@gitster.siamese.dyndns.org","threadId":"14075","inReplyTo":"alpine.LNX.1.10.0806221107540.15126@fbirervta.pbzchgretzou.qr","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-22T09:40:27Z","receivedAt":"2008-06-22T09:40:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Engelhardt <jengelh@medozas.de> writes:\n\n> I am aware that this is a less / xterm issue, but I wanted to let\n> you know.\n\nDo you mean \"me\" by \"let you know\"?  Well, I have already been aware of\nit, thanks.\n"},{"id":"80602","messageId":"19f34abd0806220249u6586c981hb1a31e7a67bad696@mail.gmail.com","threadId":"14075","inReplyTo":"alpine.LNX.1.10.0806221107540.15126@fbirervta.pbzchgretzou.qr","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Vegard Nossum","fromEmail":"vegard.nossum@gmail.com","sentAt":"2008-06-22T09:49:36Z","receivedAt":"2008-06-22T09:49:36Z","isPatch":false,"sender":{"key":"vegard.nossum@gmail.com","avatar":null},"body":"On Sun, Jun 22, 2008 at 11:09 AM, Jan Engelhardt <jengelh@medozas.de> wrote:\n> I've played with `less -F` for a while now, and there is an inherent\n> problem with that. Or should I say, xterm.\n> When less quits, the xterm \"screen\" blits back to the shell output\n> that was previously visible, so\n>        git status\n> with less -F as a pager displays practically *nothing*.\n> I am aware that this is a less / xterm issue, but I wanted to let\n> you know.\n>\n\nOption -X should do the trick :-)\n\n\nVegard\n\n-- \n\"The animistic metaphor of the bug that maliciously sneaked in while\nthe programmer was not looking is intellectually dishonest as it\ndisguises that the error is the programmer's own creation.\"\n\t-- E. W. Dijkstra, EWD1036\n"},{"id":"80603","messageId":"7vtzfln5zw.fsf@gitster.siamese.dyndns.org","threadId":"14075","inReplyTo":"7vtzflolis.fsf@gitster.siamese.dyndns.org","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-22T10:01:07Z","receivedAt":"2008-06-22T10:01:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jan Engelhardt <jengelh@medozas.de> writes:\n>\n>> I am aware that this is a less / xterm issue, but I wanted to let\n>> you know.\n>\n> Do you mean \"me\" by \"let you know\"?  Well, I have already been aware of\n> it, thanks.\n\nHaving said all that, I have to say I am regretting to have accepted that\npatch to enable pager on status, not because it bothers me personally (it\ndoesn't primarily because I practically never run git-status because I\nconsider the command useless and living almost always in Emacs helps), but\nbecause in principle changing anything that existing users are used to is\nbad.\n\nJeff had a patch to allow boolean configuration variable \"pager.<command>\"\nto override the built-in pager settings during 1.5.6 cycle, and I think it\nwas a reasonable approach to take.  People who want to page output from\ngit-status can then set \"pager.status = true\" in their configuration (and\nthen we can revert c8af1de (make git-status use a pager, 2008-04-23)).\nAlternatively we could keep the current status-quo for the default, and\npeople can say \"pager.status = false\" in their configuration.\n"},{"id":"80710","messageId":"20080623152309.GA24101@sigill.intra.peff.net","threadId":"14075","inReplyTo":"7vtzfln5zw.fsf@gitster.siamese.dyndns.org","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-23T15:23:10Z","receivedAt":"2008-06-23T15:23:10Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jun 22, 2008 at 03:01:07AM -0700, Junio C Hamano wrote:\n\n> Jeff had a patch to allow boolean configuration variable \"pager.<command>\"\n> to override the built-in pager settings during 1.5.6 cycle, and I think it\n> was a reasonable approach to take.  People who want to page output from\n> git-status can then set \"pager.status = true\" in their configuration (and\n> then we can revert c8af1de (make git-status use a pager, 2008-04-23)).\n> Alternatively we could keep the current status-quo for the default, and\n> people can say \"pager.status = false\" in their configuration.\n\nI have been running with the patch for a month or two, and it works fine\nfor controlling the pager. Unfortunately, there is a nasty interaction\nin the git wrapper with reading the config file early, and we end up not\ncalculating the GIT_DIR and worktree in the same way. I think this is\npart of a larger problem which needs solving, but everytime I look at\nit, my eyes start bleeding (and I have to admit, since the patch does\nwork, I have forgotten how annoyed I was at the paging behavior in the\nfirst place, and I don't have as much motivation to work on it).\n\nI think this is deeply related to the \"git config alias.st status && cd\n.git && git st\" problem, which is also on my long-term todo. So I'll see\nif I can do something about it during this release cycle.\n\n-Peff\n"},{"id":"81229","messageId":"g3v3s1$bok$1@ger.gmane.org","threadId":"14075","inReplyTo":"20080622072420.GA5161@dualtron.vpn.rwth-aachen.de","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Dan McGee","fromEmail":"dpmcgee@gmail.com","sentAt":"2008-06-26T03:53:36Z","receivedAt":"2008-06-26T03:53:36Z","isPatch":false,"sender":{"key":"dpmcgee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/265817?v=4"},"body":"On 06/22/2008 05:01 AM, Junio C Hamano wrote:\n>> Having said all that, I have to say I am regretting to have accepted that\n>> patch to enable pager on status, not because it bothers me personally (it\n>> doesn't primarily because I practically never run git-status because I\n>> consider the command useless and living almost always in Emacs helps), but\n>> because in principle changing anything that existing users are used to is\n>> bad.\n\nI'm a bit late on the uptake here, but I wanted to throw my two cents in- this was one of the biggest usability flubs I've seen with git in a long time. I suspect (actually, I *know*) there were many users like I that used git-status all the time in the console to get a handle on what their work tree was looking like. That became impossible with 1.5.6 out of the box, and I have to spend an hour reading mailing list posts trying to restore the former non-broken behavior.\n\nWhy did this patch get pulled in with so little discussion? Didn't someone think that there must be a reason git-status didn't use a pager before?\n\nOn 06/22/2008 02:24 AM, Johannes Gilger wrote:\n> On 21/06/08 23:42, Johannes Gilger wrote:\n>> Wow, I just noticed it myself. Why was that changed? I don't know about \n>> your status lines, but I for one find it really annoying. Anything \n>> that's in a pager isn't visible in my console afterwards. What's next? \n>> git branch in a pager too?\n> \n> Seems like I got ahead of myself there. After setting the core.pager to \n> less -FRSX everything works fine ;)\n\nThis is a terrible thing to force users to have to do. Not only that, but the interaction between GIT_PAGER, core.pager, and everything else just makes this change even more hard to swallow.\n\nI probably came across as flame/troll here, but I felt I needed to speak up for those of us that never knew this change was coming. I would go so far as to say this should be reverted for a maint release.\n\n-Dan\n"},{"id":"81239","messageId":"vpq1w2klok9.fsf@bauges.imag.fr","threadId":"14075","inReplyTo":"g3v3s1$bok$1@ger.gmane.org","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2008-06-26T06:04:22Z","receivedAt":"2008-06-26T06:04:22Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Dan McGee <dpmcgee@gmail.com> writes:\n\n> That became impossible with 1.5.6 out of the box,\n\nActually, by default it does. It does not for you because you've set\n$LESS. That said, I argee that a config option to enable/disable the\npager per-command would have been better that the change we're talking\nabout.\n\n-- \nMatthieu\n"},{"id":"81264","messageId":"43234A8B-3201-4F4F-A9A8-3756FC95A422@wincent.com","threadId":"14075","inReplyTo":"g3v3s1$bok$1@ger.gmane.org","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-06-26T10:17:53Z","receivedAt":"2008-06-26T10:17:53Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 26/6/2008, a las 5:53, Dan McGee escribió:\n\n> Why did this patch get pulled in with so little discussion? Didn't  \n> someone think that there must be a reason git-status didn't use a  \n> pager before?\n\nI believe it was discussed in at least a couple of threads back then:\n\nOriginal patch in late April, 3 messages:\n\n   http://article.gmane.org/gmane.comp.version-control.git/80279/\n\nFollow-up discussion in early May, 31 messages:\n\n   http://article.gmane.org/gmane.comp.version-control.git/80957/\n\nWincent\n"},{"id":"81304","messageId":"20080626175124.GA3300@sigill.intra.peff.net","threadId":"14075","inReplyTo":"43234A8B-3201-4F4F-A9A8-3756FC95A422@wincent.com","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-26T17:51:24Z","receivedAt":"2008-06-26T17:51:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 26, 2008 at 12:17:53PM +0200, Wincent Colaiuta wrote:\n\n> Follow-up discussion in early May, 31 messages:\n>\n>   http://article.gmane.org/gmane.comp.version-control.git/80957/\n\nAnd I posted several patches in that thread to make paging configuration\nmore fine-grained, but they got caught up in some setup_git_* bermuda\ntriangle. Dan (and others who dislike the new change), I would be very\nhappy if you wanted to take a look at them and see if you can address\nsome of the issues I raised.\n\n-Peff\n"},{"id":"82061","messageId":"20080703021541.GK18147@mail.rocksoft.com","threadId":"14075","inReplyTo":"7vtzfln5zw.fsf@gitster.siamese.dyndns.org","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Tim Stoakes","fromEmail":"tim@stoakes.net","sentAt":"2008-07-03T02:15:41Z","receivedAt":"2008-07-03T02:15:41Z","isPatch":false,"sender":{"key":"tim@stoakes.net","avatar":null},"body":"Junio C Hamano(gitster@pobox.com)@220608-03:01:\n> Having said all that, I have to say I am regretting to have accepted that\n> patch to enable pager on status, not because it bothers me personally (it\n> doesn't primarily because I practically never run git-status because I\n> consider the command useless and living almost always in Emacs helps), but\n> because in principle changing anything that existing users are used to is\n> bad.\n> \n> Jeff had a patch to allow boolean configuration variable \"pager.<command>\"\n> to override the built-in pager settings during 1.5.6 cycle, and I think it\n> was a reasonable approach to take.  People who want to page output from\n> git-status can then set \"pager.status = true\" in their configuration (and\n> then we can revert c8af1de (make git-status use a pager, 2008-04-23)).\n> Alternatively we could keep the current status-quo for the default, and\n> people can say \"pager.status = false\" in their configuration.\n\nI'd really like to see this. Setting core.pager to `less -FSRX` or\nsimilar is not useful for me - I *want* to have -X for eg. `git diff`,\nbut I don't want paging at all for status.\n\nThis was quite a nasty change to sneak on people I think.\n\nTim\n\n-- \nTim Stoakes\n"},{"id":"82102","messageId":"20080703114656.GA15101@sigill.intra.peff.net","threadId":"14075","inReplyTo":"20080703021541.GK18147@mail.rocksoft.com","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-07-03T11:46:57Z","receivedAt":"2008-07-03T11:46:57Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 03, 2008 at 11:45:41AM +0930, Tim Stoakes wrote:\n\n> > Jeff had a patch to allow boolean configuration variable \"pager.<command>\"\n> > to override the built-in pager settings during 1.5.6 cycle, and I think it\n> > was a reasonable approach to take.  People who want to page output from\n> > git-status can then set \"pager.status = true\" in their configuration (and\n> > then we can revert c8af1de (make git-status use a pager, 2008-04-23)).\n> > Alternatively we could keep the current status-quo for the default, and\n> > people can say \"pager.status = false\" in their configuration.\n> \n> I'd really like to see this. Setting core.pager to `less -FSRX` or\n> similar is not useful for me - I *want* to have -X for eg. `git diff`,\n> but I don't want paging at all for status.\n\nOK, here is a revised patch that actually passes the tests. I'm not\nincredibly happy with it (see the caveats below), but I think this is\nthe best we can do without major surgery on the git_dir setup (there\nseems to be some nasty interaction between setup_git_env and\nsetup_git_directory, but several attempts at obvious fixes have left me\npulling my hair out).\n\n-- >8 --\nallow per-command pager config\n\nThere is great debate over whether some commands should set\nup a pager automatically. This patch allows individuals to\nset their own pager preferences for each command, overriding\nthe default. For example, to disable the pager for git\nstatus:\n\n  git config pager.status false\n\nIf \"--pager\" or \"--no-pager\" is specified on the command\nline, it takes precedence over the config option.\n\nThere are two caveats:\n\n  - you can turn on the pager for plumbing commands.\n    Combined with \"core.pager = always\", this will probably\n    break a lot of things. Don't do it.\n\n  - This only works for builtin commands. The reason is\n    somewhat complex:\n\n    Calling git_config before we do setup_git_directory\n    has bad side effects, because it wants to know where\n    the git_dir is to find \".git/config\". Unfortunately,\n    we cannot call setup_git_directory indiscriminately,\n    because some builtins (like \"init\") break if we do.\n\n    For builtins, this is OK, since we can just wait until\n    after we call setup_git_directory. But for aliases, we\n    don't know until we expand (recursively) which command\n    we're doing. This should not be a huge problem for\n    aliases, which can simply use \"--pager\" or \"--no-pager\"\n    in the alias as appropriate.\n\n    For external commands, however, we don't know we even\n    have an external command until we exec it, and by then\n    it is too late to check the config.\n\n    An alternative approach would be to have a config mode\n    where we don't bother looking at .git/config, but only\n    at the user and system config files. This would make the\n    behavior consistent across builtins, aliases, and\n    external commands, at the cost of not allowing per-repo\n    pager config for at all.\n---\n git.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++----\n 1 files changed, 47 insertions(+), 4 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex 22ac522..426a17f 100644\n--- a/git.c\n+++ b/git.c\n@@ -9,6 +9,43 @@ const char git_usage_string[] =\n const char git_more_info_string[] =\n \t\"See 'git help COMMAND' for more information on a specific command.\";\n \n+static int use_pager = -1;\n+struct pager_config {\n+\tconst char *cmd;\n+\tint val;\n+};\n+\n+static int pager_command_config(const char *var, const char *value, void *data)\n+{\n+\tstruct pager_config *c = data;\n+\tif (!prefixcmp(var, \"pager.\") && !strcmp(var + 6, c->cmd))\n+\t\tc->val = 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+\tstruct pager_config c;\n+\tc.cmd = cmd;\n+\tc.val = -1;\n+\tgit_config(pager_command_config, &c);\n+\treturn c.val;\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@@ -38,9 +75,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@@ -242,8 +279,13 @@ 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-\t\tsetup_pager();\n+\n+\tif (use_pager == -1 && p->option & RUN_SETUP)\n+\t\tuse_pager = check_pager_config(p->cmd);\n+\tif (use_pager == -1 && p->option & USE_PAGER)\n+\t\tuse_pager = 1;\n+\tcommit_pager_choice();\n+\n \tif (p->option & NEED_WORK_TREE)\n \t\tsetup_work_tree();\n \n@@ -453,6 +495,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.6.1.158.g8cb5.dirty\n"},{"id":"82110","messageId":"alpine.DEB.1.00.0807031303080.9925@racer","threadId":"14075","inReplyTo":"20080703021541.GK18147@mail.rocksoft.com","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-07-03T12:11:02Z","receivedAt":"2008-07-03T12:11:02Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 3 Jul 2008, Tim Stoakes wrote:\n\n> This [changing git status to use the pager automatically] was quite a \n> nasty change to sneak on people I think.\n\nWell, I think that a command producing pages and pages of output without \nstopping is useless.  Therefore, _I_ maintain that it makes tons of sense.\n\nOf course, if you find enough support for a patch reverting it, I might \nhave to accept the fact that \"git status\" becomes less useful for me.\n\nCiao,\nDscho\n"},{"id":"82128","messageId":"08353871-5C94-4E97-9589-DC3980C47CD4@wincent.com","threadId":"14075","inReplyTo":"alpine.DEB.1.00.0807031303080.9925@racer","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-07-03T13:37:30Z","receivedAt":"2008-07-03T13:37:30Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 3/7/2008, a las 14:11, Johannes Schindelin escribió:\n\n> Hi,\n>\n> On Thu, 3 Jul 2008, Tim Stoakes wrote:\n>\n>> This [changing git status to use the pager automatically] was quite a\n>> nasty change to sneak on people I think.\n>\n> Well, I think that a command producing pages and pages of output  \n> without\n> stopping is useless.  Therefore, _I_ maintain that it makes tons of  \n> sense.\n\nDitto. For me, the change was very welcome. Sure, usually the status  \noutput is short, but on those occasions where it isn't (big file  \nreorganizations etc) I was quite sick of doing the \"git status, oops  \nthat output was too long let's try again, git -p status\" dance. It was  \nalso incongruous with my very first experiences with Git, where I had  \nbeen pleasantly surprised that \"git log\" automatically invoked the  \npager whereas \"svn log\" just spewed output into my console until ^C.\n\nCheers,\nWincent\n"},{"id":"82143","messageId":"20080703190829.GA18205@sigill.intra.peff.net","threadId":"14075","inReplyTo":"08353871-5C94-4E97-9589-DC3980C47CD4@wincent.com","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-07-03T19:08:29Z","receivedAt":"2008-07-03T19:08:29Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 03, 2008 at 03:37:30PM +0200, Wincent Colaiuta wrote:\n\n>>> This [changing git status to use the pager automatically] was quite a\n>>> nasty change to sneak on people I think.\n>>\n>> Well, I think that a command producing pages and pages of output\n>> without stopping is useless.  Therefore, _I_ maintain that it makes\n>> tons of  sense.\n>\n> Ditto. For me, the change was very welcome. Sure, usually the status\n> output is short, but on those occasions where it isn't (big file\n> reorganizations etc) I was quite sick of doing the \"git status, oops\n> that output was too long let's try again, git -p status\" dance. It was\n> also incongruous with my very first experiences with Git, where I had\n> been pleasantly surprised that \"git log\" automatically invoked the\n> pager whereas \"svn log\" just spewed output into my console until ^C.\n\nI think there is not much point in discussing whether \"git status\"\nshould use a pager. It is obvious at this point that some people love\nit, and some people despise it, and it seems to be a matter of personal\npreference. The only sane way forward seems to be configurable paging.\nSo the next steps are:\n\n  - getting a configurable paging patch that is good enough; I just\n    posted another trial, but there are still a few caveats. I would\n    love to hear commentary on whether people find it acceptable.\n\n  - once there is a patch, there is still the matter of \"on by default,\n    make people configure off\" versus \"off by default, make people\n    configure on\". And then you can make arguments about how the default\n    changes the new user experience, but hopefully there will be a\n    little less vehemence on both sides, since it is \"here's what new\n    users should see\" and not \"here's what I am forced to see every\n    day\".\n\n-Peff\n"},{"id":"82150","messageId":"E80011CA-A8D7-4019-8CE4-CDA226A75608@wincent.com","threadId":"14075","inReplyTo":"20080703190829.GA18205@sigill.intra.peff.net","subject":"Re: about c8af1de9 (git status uses pager)","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-07-03T20:10:34Z","receivedAt":"2008-07-03T20:10:34Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 3/7/2008, a las 21:08, Jeff King escribió:\n\n> On Thu, Jul 03, 2008 at 03:37:30PM +0200, Wincent Colaiuta wrote:\n>\n>>>> This [changing git status to use the pager automatically] was  \n>>>> quite a\n>>>> nasty change to sneak on people I think.\n>>>\n>>> Well, I think that a command producing pages and pages of output\n>>> without stopping is useless.  Therefore, _I_ maintain that it makes\n>>> tons of  sense.\n>>\n>> Ditto. For me, the change was very welcome. Sure, usually the status\n>> output is short, but on those occasions where it isn't (big file\n>> reorganizations etc) I was quite sick of doing the \"git status, oops\n>> that output was too long let's try again, git -p status\" dance. It  \n>> was\n>> also incongruous with my very first experiences with Git, where I had\n>> been pleasantly surprised that \"git log\" automatically invoked the\n>> pager whereas \"svn log\" just spewed output into my console until ^C.\n>\n> I think there is not much point in discussing whether \"git status\"\n> should use a pager. It is obvious at this point that some people love\n> it, and some people despise it, and it seems to be a matter of  \n> personal\n> preference. The only sane way forward seems to be configurable paging.\n\nI completely agree. I just don't like it when people use words like  \n\"nasty\" and \"sneak\" to describe a change that was discussed in one  \nshort and one long thread prior to being incorporated. But you're  \nright; there's no sense in discussing the \"whether\" any more.\n\nCheers,\nWincent\n"}]}