From 76374571d88beb345274a8559af3d27c8518a6ba Mon Sep 17 00:00:00 2001 From: ccoVeille <3875889+ccoVeille@users.noreply.github.com> Date: Sun, 21 Apr 2024 16:37:51 +0200 Subject: [PATCH] Add FORGIT_STASH_SHOW_PREVIEW_GIT_OPTS This variable can be used to tune the rendering of the stash preview. The following example allows listing the content of the stash before opening it. FORGIT_STASH_SHOW_PREVIEW_GIT_OPTS="--patch-with-stat --stat-count=10" --- README.md | 2 +- bin/git-forgit | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a6437add..69610cf0 100644 --- a/README.md +++ b/README.md @@ -243,7 +243,7 @@ These are passed to the according `git` calls. | `gct` | `FORGIT_CHECKOUT_TAG_GIT_OPTS` | | `gco` | `FORGIT_CHECKOUT_COMMIT_GIT_OPTS` | | `grc` | `FORGIT_REVERT_COMMIT_GIT_OPTS` | -| `gss` | `FORGIT_STASH_SHOW_GIT_OPTS` | +| `gss` | `FORGIT_STASH_SHOW_GIT_OPTS`, `FORGIT_STASH_SHOW_PREVIEW_GIT_OPTS` | | `gsp` | `FORGIT_STASH_PUSH_GIT_OPTS` | | `gclean` | `FORGIT_CLEAN_GIT_OPTS` | | `grb` | `FORGIT_REBASE_GIT_OPTS` | diff --git a/bin/git-forgit b/bin/git-forgit index 00329c50..ae7fd369 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -395,7 +395,9 @@ _forgit_reset_head() { _forgit_stash_show_preview() { local stash stash=$(echo "$1" | cut -d: -f1) - _forgit_git_stash_show "$stash" | _forgit_pager diff + _forgit_stash_show_preview_git_opts=() + _forgit_parse_array _forgit_stash_show_preview_git_opts "$FORGIT_STASH_SHOW_PREVIEW_GIT_OPTS" + _forgit_git_stash_show "${_forgit_stash_show_preview_git_opts[@]}" -- "$stash" | _forgit_pager diff } _forgit_git_stash_show() {