# [PATCH] stash: Utilize config variable pager.stash.list in stash list command

5 messages from 2011-08-16 to 2011-08-18. Participants: Ingo Brückl, Junio C Hamano, Jeff King.
Thread: https://gitlist.dev/t/28121

## Ingo Brückl, 2011-08-16 11:47

Subject: [PATCH] stash: Utilize config variable pager.stash.list in stash list command
Message-ID: <4e4a58c2.48d6f6ce.bm001@wupperonline.de>
URL: https://gitlist.dev/e/4e4a58c2.48d6f6ce.bm001%40wupperonline.de

```
Usually it is annoying that the pager is used for stash list output,
so the config variable pager.stash.list will be utilized now and is
a way to control stash list's behavior.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
---
 git-stash.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index f4e6f05..29702ab 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -264,7 +264,8 @@ have_stash () {

 list_stash () {
 	have_stash || return 0
-	git log --format="%gd: %gs" -g "$@" $ref_stash --
+	test "$(git config --get pager.stash.list)" = "false" && no_pager=--no-pager
+	git $no_pager log --format="%gd: %gs" -g "$@" $ref_stash --
 }

 show_stash () {
--
1.7.6

```

## Ingo Brückl, 2011-08-17 09:04

Subject: Re: [PATCH] stash: Utilize config variable pager.stash.list in stash list command
Message-ID: <4e4b8418.068889fb.bm001@wupperonline.de>
URL: https://gitlist.dev/e/4e4b8418.068889fb.bm001%40wupperonline.de
In-Reply-To: <4e4a58c2.48d6f6ce.bm001@wupperonline.de>

```
Usually it is annoying that the pager is used for stash list output,
so the config variable pager.stash.list will be utilized now and is
a way to control stash list's behavior.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
---
 This is the 2nd attempt, now checking for true and false.

 git-stash.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index f4e6f05..3712a17 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -264,7 +264,10 @@ have_stash () {

 list_stash () {
 	have_stash || return 0
-	git log --format="%gd: %gs" -g "$@" $ref_stash --
+	l_config=$(git config --get pager.stash.list)
+	test "$l_config" = "true" && p_option=--paginate
+	test "$l_config" = "false" && p_option=--no-pager
+	git $p_option log --format="%gd: %gs" -g "$@" $ref_stash --
 }

 show_stash () {
--
1.7.6

```

## Junio C Hamano, 2011-08-17 18:44

Subject: Re: [PATCH] stash: Utilize config variable pager.stash.list in stash list command
Message-ID: <7vd3g3ev3j.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd3g3ev3j.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4e4b8418.068889fb.bm001@wupperonline.de>

```
At least "pager.stash.list" should be spelled as "pager.stashList" or
something. It is not like there are multitude of arbigrary choices that
may match "pager.*.list" pattern.

Also a variable can be set to false by setting it to 0, no, etc., so you
need to inspect it with "git config --bool" to get the canonical version
of its value.

What's so difficult to say "git stash list | less" or even "git -p stash list"?

```

## Jeff King, 2011-08-18 04:26

Subject: Re: [PATCH] stash: Utilize config variable pager.stash.list in stash list command
Message-ID: <20110818042620.GA19045@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110818042620.GA19045%40sigill.intra.peff.net
In-Reply-To: <7vd3g3ev3j.fsf@alter.siamese.dyndns.org>

```
On Wed, Aug 17, 2011 at 11:44:32AM -0700, Junio C Hamano wrote:

> At least "pager.stash.list" should be spelled as "pager.stashList" or
> something. It is not like there are multitude of arbigrary choices that
> may match "pager.*.list" pattern.

The pager code would then assume that was for a command "stashlist". It
probably doesn't matter in practice, but I think it's a little nicer to
keep the namespace properly separated unless there is a good reason not
to.

There are other places where something like this might be handy, too.
For example, auto-pagination of "git branch" or "git tag -l" (but you
wouldn't want to paginate "git branch foo").

> Also a variable can be set to false by setting it to 0, no, etc., so
> you need to inspect it with "git config --bool" to get the canonical
> version of its value.
> 
> What's so difficult to say "git stash list | less" or even "git -p
> stash list"?

Couldn't one make the same argument about git's entire use of the pager?

Anyway, I think his problem is not "I want a pager but I am too lazy to
type it", but rather that "git stash list" will auto-paginate by
default, because it is chaining to "log", which auto-paginates. You can
turn it off with "--no-pager", but pager.stash seems to have no effect.

-Peff

```

## Ingo Brückl, 2011-08-18 07:55

Subject: Re: [PATCH] stash: Utilize config variable pager.stash.list in stash list command
Message-ID: <4e4cc57e.51253792.bm000@wupperonline.de>
URL: https://gitlist.dev/e/4e4cc57e.51253792.bm000%40wupperonline.de
In-Reply-To: <20110818042620.GA19045@sigill.intra.peff.net>

```
Jeff King wrote on Wed, 17 Aug 2011 21:26:37 -0700:

> On Wed, Aug 17, 2011 at 11:44:32AM -0700, Junio C Hamano wrote:

>> What's so difficult to say "git stash list | less" or even "git -p
>> stash list"?

> Anyway, I think his problem is not "I want a pager but I am too lazy to
> type it", but rather that "git stash list" will auto-paginate by
> default, because it is chaining to "log", which auto-paginates. You can
> turn it off with "--no-pager", but pager.stash seems to have no effect.

I'd like to mention that in this particular case it is ok that stash
auto-paginates, it only is annoying that "stash list" does. And, Junio,
it is totally ok to say "git -p stash list" then, because this is exactely
what I'd do.

Ingo

```
