Skip to contentSkip to conversation

stash: Don't paginate by default with list command

PATCH In review Ingo Brückl 4 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stash: Don't paginate by default with list command

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

---
 git-stash.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-stash.sh +1 -1
index 31dec0a..b92d986 100755
@@ -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

#1 lore raw

Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:

Quoted 2 lines

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

#2 lore raw

Ben Walton wrote on Tue, 30 Aug 2011 13:43:46 -0400:

Quoted 8 lines

Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:

Quoted 2 lines

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

#3 lore raw
Quoted 7 lines · Ingo Brückl

Ben Walton wrote on Tue, 30 Aug 2011 13:43:46 -0400:

Quoted 4 lines

Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:

Quoted 2 lines

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

Quoted 6 lines
Quoted 3 lines

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

#4 lore raw
In reply to Ingo Brückl

I wrote on Tue, 30 Aug 2011 20:24:04 +0200:

Quoted 7 lines

Ben Walton wrote on Tue, 30 Aug 2011 13:43:46 -0400:

Quoted 4 lines

Excerpts from Ingo Brückl's message of Tue Aug 30 13:21:18 -0400 2011:

Quoted 2 lines

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

Quoted 6 lines
Quoted 3 lines

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

#5 lore raw
In reply to Ingo Brückl
Quoted 2 lines · Ingo Brückl

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

#6 lore raw
Quoted 9 lines · Raphael Zimmerer
Quoted 2 lines · Ingo Brückl

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'.

#7 lore raw

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

Quoted 4 lines

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