threads / patch / 9105

patchDocument how to tell git to not launch a pager

Subject: [PATCH] Document how to tell git to not launch a pager

## tl;dr

12 messages between Jul 19, 2007 and Jul 19, 2007. Diffs are folded; open one to read it.

replies: 11people: 10as markdown or json

Steven Grimm· Jul 19, 2007, 10:43 UTC · lore
Signed-off-by: Steven Grimm <koreth@midwinter.com>
---
 Documentation/git.txt |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Show changes to Documentation/git.txt +3 −1
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 3fbfd45..4c4d174 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -417,7 +417,9 @@ other
 	See gitlink:git-merge[1]
 
 'GIT_PAGER'::
-	This environment variable overrides `$PAGER`.
+	This environment variable overrides `$PAGER`. If it is set
+	to an empty string or to the value "cat", git will not launch
+	a pager.
 
 'GIT_FLUSH'::
 	If this environment variable is set to "1", then commands such
-- 
1.5.3.rc2.4.g726f9
martin f krafft· Jul 19, 2007, 11:02 UTC · re: Steven Grimm · lore

Re: [PATCH] Document how to tell git to not launch a pager

also sprach Steven Grimm <koreth@midwinter.com> [2007.07.19.1243 +0200]:
Show 5 quoted lines
>  'GIT_PAGER'::
> -	This environment variable overrides `$PAGER`.
> +	This environment variable overrides `$PAGER`. If it is set
> +	to an empty string or to the value "cat", git will not launch
> +	a pager.

+1 on the patch, but I also wonder why use of a pager is default in git anyway. At least I find it to be contrary to what I am used to on the Unix command line.

For reference, there was an argument about this in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=424978, which includes a long IRC log in German, unfortunately, where a bunch of people agreed with my proposal *not* to use a pager by default, since it makes it difficult to use information from the output to assemble the next command on the command line. Every terminal in use nowadays can easily scroll and even search back 250 lines with the added benefit of not randomly clearing the screen when you quit $PAGER.

I am sure there is a reason for the choice of using a pager by default. Could we please either rethink this reason and possibly make it non-default, or alternatively add the reason to the FAQ?

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: madduck.bogus@madduck.net
 
no micro$oft components were used
in the creation or posting of this email.
therefore, it is 100% virus free
and does not use html by default (yuck!).
Johannes Schindelin· Jul 19, 2007, 11:13 UTC · re: martin f krafft · lore

Re: [PATCH] Document how to tell git to not launch a pager

Hi,
On Thu, 19 Jul 2007, martin f krafft wrote:
> [...] I also wonder why use of a pager is default in git anyway. At 
> least I find it to be contrary to what I am used to on the Unix command 
> line.

It was evidently liked unilaterally amongst the big whigs in the git community. Me too, I like it (which says nothing about my hair style). Often it annoys me tremendously that all the other programs like make, ls, etc. do not have this nice "-p" flag.

Ciao, Dscho

Julian Phillips· Jul 19, 2007, 11:38 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Document how to tell git to not launch a pager

On Thu, 19 Jul 2007, Johannes Schindelin wrote:
Show 12 quoted lines
> Hi,
>
> On Thu, 19 Jul 2007, martin f krafft wrote:
>
>> [...] I also wonder why use of a pager is default in git anyway. At
>> least I find it to be contrary to what I am used to on the Unix command
>> line.
>
> It was evidently liked unilaterally amongst the big whigs in the git
> community.  Me too, I like it (which says nothing about my hair style).
> Often it annoys me tremendously that all the other programs like make, ls,
> etc. do not have this nice "-p" flag.

I love it. It's currently playing merry havoc with my Subversion usage at work though. I've got so used to git never chucking things off the top of the screen that I keep forgetting to run 'svn ... | less'.

Also searching in a console isn't anywhere near as easy.
-- 
Julian

  ---
Sometimes a man who deserves to be looked down upon because he is a
fool is despised only because he is a lawyer.
 		-- Montesquieu
David Kastrup· Jul 19, 2007, 12:01 UTC · re: Julian Phillips · lore

Re: [PATCH] Document how to tell git to not launch a pager

Julian Phillips <julian@quantumfyre.co.uk> writes:
Show 20 quoted lines
> On Thu, 19 Jul 2007, Johannes Schindelin wrote:
>
>> Hi,
>>
>> On Thu, 19 Jul 2007, martin f krafft wrote:
>>
>>> [...] I also wonder why use of a pager is default in git anyway. At
>>> least I find it to be contrary to what I am used to on the Unix command
>>> line.
>>
>> It was evidently liked unilaterally amongst the big whigs in the git
>> community.  Me too, I like it (which says nothing about my hair style).
>> Often it annoys me tremendously that all the other programs like make, ls,
>> etc. do not have this nice "-p" flag.
>
> I love it. It's currently playing merry havoc with my Subversion usage
> at work though.  I've got so used to git never chucking things off the
> top of the screen that I keep forgetting to run 'svn ... | less'.
>
> Also searching in a console isn't anywhere near as easy.
Is that the reason why users of screen get punished by default?
-- 
David Kastrup
Linus Torvalds· Jul 19, 2007, 18:29 UTC · re: David Kastrup · lore

Re: [PATCH] Document how to tell git to not launch a pager

On Thu, 19 Jul 2007, David Kastrup wrote:
> 
> Is that the reason why users of screen get punished by default?

No, the reason users of screen get punished is that we just think they are fun to torment.

Just use GIT_PAGER=cat, and be happy. In fact, I'd suggest not using screen at all (what a piece of horrid crap), but some people have trouble letting go.

		Linus
Nikolai Weibull· Jul 19, 2007, 18:51 UTC · re: Linus Torvalds · lore

Re: [PATCH] Document how to tell git to not launch a pager

On 7/19/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> In fact, I'd suggest not using screen at all (what a piece of horrid crap),
> but some people have trouble letting go.
I don't want to start a holy war here, but what's wrong with screen?
And what should we be embracing instead?
  nikolai
Linus Torvalds· Jul 19, 2007, 19:14 UTC · re: Nikolai Weibull · lore

Re: [PATCH] Document how to tell git to not launch a pager

On Thu, 19 Jul 2007, Nikolai Weibull wrote:
> 
> I don't want to start a holy war here, but what's wrong with screen?

I actually like screen as a way to keep connections around. But the whole multiplexing is wrong, wrong, wrong. It violates the "do one thing, and do it well" thing. It makes screen do two things, and do them really badly as a result.

So the "session" part makes sense. It's a worthy reason to use screen.

And the "window manager" part is kind of a funny hack, but let's face it, you can do better by using separate windows.

And the multiplexor could have been done (and historically _has_ been done) better, by not limiting it to terminal sessions.

But the *combination* of all three is just evil and stupid. And the choice of ctrl-A as the default command sequence (can you even override it? Don't know, don't care) is just insanity.

It's somewhat sad that screen has made some better projects not as successful.

 - multiplexing. I used better programs back in the 90's to multiplex 
   arbitrary sessions over a single terminal pipe (not just terminal 
   windows). I forget the name, because these days, everybody has real 
   networking, and you'd generally use ssh tunnelling for it and 
   ssh-agent. But screen was never very good at it.
 - "window manager". Quite frankly, I've never needed it. I doubt many 
   people do. graphical environments and virtual terminals are better. And 
   if you really want a virtual terminal on a single terminal, thinking 
   that it should be mixed up with all the other things screen does is 
   just nasty.
 - for session management and moving things around: I think this is the 
   main reason people still use screen. It's a worthy use, but I think 
   it's sad how it's mixed up with the bad features of screen. There was a 
   "detach" program (or something similar) at some point that did just 
   that part of screen. But screen is just widely enough spread that 
   people are used to it, and I don't think it went anywhere.

IOW, I think screen sucks because it tries to do totally independent things, and then mixes them up in nasty ways, and for historical reasons uses a bad break character too.

Oh, well.
			Linus
Matthieu Moy· Jul 19, 2007, 19:34 UTC · re: Linus Torvalds · lore

Re: [PATCH] Document how to tell git to not launch a pager

Linus Torvalds <torvalds@linux-foundation.org> writes:
> But the *combination* of all three is just evil and stupid. And the choice 
> of ctrl-A as the default command sequence (can you even override it? Don't 
> know, don't care) is just insanity.
Yes, you can. For example, I have
  escape ^oo

in my ~/.screenrc, and the control command is C-o, and I can do a real C-o by doing C-o o.

That said, I rarely use screen, just to launch a long command at work and get the result from home later.

-- 
Matthieu
Thomas Glanzmann· Jul 19, 2007, 19:50 UTC · re: Linus Torvalds · lore

Re: [PATCH] Document how to tell git to not launch a pager

Hello Linus,
I personally use screen a lot. I have a few screen sessions running:
	- a main screen carring 70 windows. Where I do my daily work and
	  read my mail on. I recompiled screen to support more than 40
	  winodws. This screen session runs on a well connected machine.
	  And consumes 175M resistent memory and 450M virtual memory.
	  That's mainly because I have 5000 lines of scrollback buffer
	  in each window and I had to recompile screen with all it's
	  buffers 2x to fight a symtom that it always crashed for me
	  when I resized it to fullscreen on a monitor with resolution
	  of 1600x1200. Yes I did fight symptoms some times even if I
	  don't like it. But had you ever a look at the screen source
	  code. It does make you puke.
	- a local screen. If I do something on a local machine I don't
	  open a single terminal I open a screen session with 5 windows.
	  Even if I only need a single shell.  The local screen only
	  stays open as long as I am logged in. I switch machines often.
	  I have a workstation at home, one at university, a laptop and
	  one at work.
	- a console screen (I do a lot of system administration) so the
	  serial consoles of the main servers at university are
	  connected to a screen session. Often are up to 5 people are
	  connected to that session. When you have to do some sort of
	  maintance work we often do a telephone conference while
	  everyone sees what is going on.
	- a so called development screen. As you can imagine having 70
	  windows open you do a lot of context switches and as you
	  stated before "do one thing and do it well" does not work that
	  way when there is you mailreader in the way on window 6, so
	  when I do something I have to focus on I use the development
	  screen. For short projects I use the development screen.
	- one screen for work related stuff.
> I actually like screen as a way to keep connections around. But the
> whole multiplexing is wrong, wrong, wrong. It violates the "do one
> thing, and do it well" thing. It makes screen do two things, and do
> them really badly as a result.

so true, as I stated above. When I notice that I go sideways I use one screen per topic.

> And the "window manager" part is kind of a funny hack, but let's face
> it, you can do better by using separate windows.

Why I started to use screen is because I often switch workstations. And I want to be able to go on where I left of. So I have the same environment on every machine I have access to and synchronize this environment. I use fvwm as window manager and have something configured I call SmartStart. This is a fvwm function which focus an application if it is already running and start it if it is not running.

	Ctrl Shift s => Main Screen
	Ctrl Shift l => Local Screen
	Ctrl Shift o => Opera
	...
	(thinkpad) [~] grep SmartStart .fvwm2rc | wc -l
	32
> And the multiplexor could have been done (and historically _has_ been
> done) better, by not limiting it to terminal sessions.

I actually have a macro for university that allows me to start X application out of my screen session but most of the time I use local X applications or use ssh forwarding if I have to get it from a remote machine.

> But the *combination* of all three is just evil and stupid. And the
> choice of ctrl-A as the default command sequence (can you even
> override it? Don't know, don't care) is just insanity.
yes you can, but you get used to it.
>    networking, and you'd generally use ssh tunnelling for it and 
>    ssh-agent. But screen was never very good at it.

My main screen is running in its own ssh-agent session. So does my work screen. My local has automatically the ssh-agent session from my desktop session.

> IOW, I think screen sucks because it tries to do totally independent
> things, and then mixes them up in nasty ways, and for historical
> reasons uses a bad break character too.

Well, I have to aggreee with you. Sometimes I come back to a windows where I stopped in the middle of doing something. And that is bad. However screen makes me work faster and makes it possible to switch locations often and pick up where you left of. It's biggest strength it's it biggest weakness, too.

My screen configuration have dozens of people copied. I have this fancy sticky status bar on the bottom.

http://wwwcip.informatik.uni-erlangen.de/~sithglan/shot.png
	Thomas
martin f krafft· Jul 19, 2007, 11:49 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Document how to tell git to not launch a pager

also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de> [2007.07.19.1313 +0200]:
> It was evidently liked unilaterally amongst the big whigs in the git 
> community.  Me too, I like it (which says nothing about my hair style).  
> Often it annoys me tremendously that all the other programs like make, ls, 
> etc. do not have this nice "-p" flag.

Thanks for the explanation. I'll come back and pick up this discussion once I became a big whig in the git community. Now I'll add the FAQ to the wiki.

http://git.or.cz/gitwiki/GitFaq#head-9dfc528b189148e801031d161201645af532a580
-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: madduck.bogus@madduck.net
 
"das internet wurde konzipiert, um einem atomschlag standzuhalten.
 leider hatte kein militärstratege mit der deutschen telekom
 gerechnet..."
                                                      -- attila radnai 
Brian Gernhardt· Jul 19, 2007, 14:38 UTC · re: martin f krafft · lore

Re: [PATCH] Document how to tell git to not launch a pager

On Jul 19, 2007, at 7:02 AM, martin f krafft wrote:
Show 13 quoted lines
> +1 on the patch, but I also wonder why use of a pager is default in
> git anyway. At least I find it to be contrary to what I am used to
> on the Unix command line.
>
> For reference, there was an argument about this in
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=424978, which
> includes a long IRC log in German, unfortunately, where a bunch of
> people agreed with my proposal *not* to use a pager by default,
> since it makes it difficult to use information from the output to
> assemble the next command on the command line. Every terminal in use
> nowadays can easily scroll and even search back 250 lines with the
> added benefit of not randomly clearing the screen when you quit
> $PAGER.

I think it's because much of the core git community lives more on the console or simple terminals like xterm than in something with easy search and scrolling features like konsole or Terminal.app. Git output tends to become very long very quickly, and usually you want to start reading from the beginning.

Many command line tools either output small chunks of input (ls, in most directories), output slowly (make), or their input is mostly only important when it errors out (make). Git's output tends to be quite long and have the most relevant (read: recent) information at the beginning so paging is pretty much a must, instead of an occasional need.

If someone thinks that git paging by default is obnoxious, it just takes running "git config --global core.pager cat". Now, no more paging. If you find your $PAGER clearing the screen when quitting obnoxious, I suggest checking your configuration. In particular, I find setting $LESS to "FX" (at least) to be most useful.

~~ Brian

← back to recent threads