From: Jakub Narebski Date: Sat, 03 Mar 2007 20:27:55 GMT Subject: Re: [PATCH] Quick description of possible gitattributes system Message-ID: <200703032127.56343.jnareb@gmail.com> In-Reply-To: On Fri, 2 Mar 2007, Linus Torvalds wrote: > On Fri, 2 Mar 2007, Jakub Narebski wrote: >> Andy Parkins wrote: >> >>> + - prettyfilter >>> +   Run by git-cat-file or git-show when content is being pretty-printed >>> +   for display to the user.  If no prettyfilter is set, then it should >>> +   default to outfilter. >> >> I'd rather have plumbing operate without filters (if it is possible), >> so git-cat-file would not run prettyfilter, and git-show would run it. [...] > So I really think that the issue here is that the *pager* should do the > right thing. Which gets us to: > >> Or at least detect if output is tty, so one can do something like >> "git cat-file -p v1.0.0:gitweb/git-logo.png > git-logo.png" and get >> expected result, while "git show v1.0.0:gitweb/git-logo.png" would >> show the image. > > Yes. How about just having the built-in git pager do the right thing? > > Right now we actually wait for data to start arriving (commit 35ce862) due > to working around a bug in less. But what if we could make the pager > actually do the right thing here automatically? With "less" just being the > default action for *text*? Wouldn't it be better and simplier instead of creating built-in magic (as in DWIM) pager, to have in place of "prettyfilter", "pretty", "show" handler "pager" handler, which would define _default_ pager for given attributes. It would mean that the filter/sink would be run only when pager is run, i.e. for "git show" and "git -p cat-file"/"git --paginate cat-file". I guess that would mean that handler action would be run only for tty. And you could always override it by setting PAGER environmental variable. So it would be: + - pager + Change default pager for this content. If it is not set, it defaults + to `less'. You can always override default pager by setting PAGER + environmental variable. -- Jakub Narebski ShadeHawk on #git Poland