Skip to content

Commit

Permalink
Add FORGIT_STASH_SHOW_PREVIEW_GIT_OPTS
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
ccoVeille committed Apr 22, 2024
1 parent bc408f1 commit 7637457
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
4 changes: 3 additions & 1 deletion bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 7637457

Please sign in to comment.