threads / patch / 28262

patchstash: Don't paginate by default with list command

Subject: [PATCH] stash: Don't paginate by default with list command

## tl;dr

8 messages between Aug 30, 2011 and Aug 31, 2011. Diffs are folded; open one to read it.

replies: 7people: 4as markdown or json

Ingo Brückl· Aug 30, 2011, 17:21 UTC · lore

The output of "stash list" is such that piping into a pager normally isn't necessary but annoying, so disable it by default.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
---
 git-stash.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-stash.sh +1 −2
diff --git a/git-stash.sh b/git-stash.sh
index 31dec0a..b92d986 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -264,7 +264,7 @@ have_stash () {

 list_stash () {
 	have_stash || return 0
-	git log --format="%gd: %gs" -g "$@" $ref_stash --
+	git --no-pager log --format="%gd: %gs" -g "$@" $ref_stash --
 }

 show_stash () {
--
1.7.6
Ben Walton· Aug 30, 2011, 17:43 UTC · re: Ingo Brückl · lore

Re: [PATCH] stash: Don't paginate by default with list command

Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:
> The output of "stash list" is such that piping into a pager
> normally isn't necessary but annoying, so disable it by default.

If you $PAGER is less and you use the default LESS environment value FRXS, this shouldn't be annoying at all. Are you using either a different pager or a different value for LESS?

Thanks -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302

Ingo Brückl· Aug 30, 2011, 18:24 UTC · re: Ben Walton · lore

Re: [PATCH] stash: Don't paginate by default with list command

Ben Walton wrote on Tue, 30 Aug 2011 13:43:46 -0400:
> Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:
>> The output of "stash list" is such that piping into a pager
>> normally isn't necessary but annoying, so disable it by default.
> If you $PAGER is less and you use the default LESS environment value
> FRXS, this shouldn't be annoying at all.  Are you using either a
> different pager or a different value for LESS?

For some reason I have '-c' in LESS which must be convenient for a case I currently don't remember.

Ingo
Raphael Zimmerer· Aug 30, 2011, 19:08 UTC · re: Ingo Brückl · lore

Re: [PATCH] stash: Don't paginate by default with list command

On Tue, Aug 30, 2011 at 08:24:04PM +0200, Ingo Brückl wrote:
Show 13 quoted lines
> Ben Walton wrote on Tue, 30 Aug 2011 13:43:46 -0400:
> 
> > Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:
> 
> >> The output of "stash list" is such that piping into a pager
> >> normally isn't necessary but annoying, so disable it by default.
> 
> > If you $PAGER is less and you use the default LESS environment value
> > FRXS, this shouldn't be annoying at all.  Are you using either a
> > different pager or a different value for LESS?
> 
> For some reason I have '-c' in LESS which must be convenient for a case
> I currently don't remember.

When you don't require the '-c' option for paging in git, please try 'core.pager = less -FRXS'. That forces git's default behaviour regardless of the LESS environment variable.

Raphael
Ingo Brückl· Aug 31, 2011, 18:18 UTC · re: Ingo Brückl · lore

Re: [PATCH] stash: Don't paginate by default with list command

I wrote on Tue, 30 Aug 2011 20:24:04 +0200:
> Ben Walton wrote on Tue, 30 Aug 2011 13:43:46 -0400:
>> Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:
>>> The output of "stash list" is such that piping into a pager
>>> normally isn't necessary but annoying, so disable it by default.
>> If you $PAGER is less and you use the default LESS environment value
>> FRXS, this shouldn't be annoying at all.  Are you using either a
>> different pager or a different value for LESS?
> For some reason I have '-c' in LESS which must be convenient for a case
> I currently don't remember.

Now I know again. '-c' is within my LESS because I like small "git diff" output printed on an erased terminal. I think it is easier to overview that way.

With "git stash list" I'd like it the other way, because that output is just a simple list (and usually very small in my case).

Ingo
Raphael Zimmerer· Aug 30, 2011, 17:57 UTC · re: Ingo Brückl · lore

Re: [PATCH] stash: Don't paginate by default with list command

On Tue, Aug 30, 2011 at 07:21:18PM +0200, Ingo Brückl wrote:
> The output of "stash list" is such that piping into a pager
> normally isn't necessary but annoying, so disable it by default.
Why is the current behaviour annoying?

Here on my (default) setup the pager automatically exits if the entire output can be displayed on the screen, as with any other git command. Is there any chance you have set the LESS environment variable somewhere? To disable the pager for some commands, cou can have a look at the *.pager config variables (man git-confg). However, 'pager.stash' is not recognized... The 'alias.*' config variables may be interesting, too.

Raphael
Junio C Hamano· Aug 30, 2011, 19:26 UTC · re: Raphael Zimmerer · lore

Re: [PATCH] stash: Don't paginate by default with list command

Raphael Zimmerer <killekulla@rdrz.de> writes:
Show 9 quoted lines
> On Tue, Aug 30, 2011 at 07:21:18PM +0200, Ingo Brückl wrote:
>> The output of "stash list" is such that piping into a pager
>> normally isn't necessary but annoying, so disable it by default.
>
> Why is the current behaviour annoying?
>
> Here on my (default) setup the pager automatically exits if the entire
> output can be displayed on the screen, as with any other git
> command.

Ben Walton pointed out exactly the same thing, but there needs one bit of caution/consideration. If you tend to use longer and more descriptive branch name (which is encouraged) and create a lazy stash without giving any message, the default description of the stash would need a fairly wide terminal window to fit on one line, e.g.

    "stash@{N}: WIP on some-long-ish-branch-name:" followed by
    "09997df a one line description of the commit your changes are made on"

concatenated on the same line. "S" in "FRSX" (the default value of "LESS" environment variable we give to those who do not have any) is a good thing to have while reviewing long-ish patches via "git log -p", but having a long line that "S" causes to be chopped counts as not being able to show the entire file on the first screen for the purpose of "F", and introduces a minor irritation of having to exit explicitly with a 'q'.

Raphael Zimmerer· Aug 30, 2011, 20:19 UTC · re: Junio C Hamano · lore

Re: [PATCH] stash: Don't paginate by default with list command

On Tue, Aug 30, 2011 at 12:26:12PM -0700, Junio C Hamano wrote: [...]

> to have while reviewing long-ish patches via "git log -p", but having a
> long line that "S" causes to be chopped counts as not being able to show
> the entire file on the first screen for the purpose of "F", and introduces
> a minor irritation of having to exit explicitly with a 'q'.

Yes, you are right. That can be annoying. Same issue when showing the reflog, but as it has lots of entries, the automatic pager is really handy. I seldom use 'stash clear' (stash is a nice way for storing working copy history somewhere...), so I don't like to miss the pager in stash list. Maybe 'pager.stash.list' as mentioned before is the way to go.

But as Ingo has set the LESS environment variable to some value ('-c'), he always has to press 'q', what may be his problem (beside of the annoyance that his less now displays '~' on each empty line).

Raphael

← back to recent threads