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 21, 2024
1 parent bc408f1 commit 4d6706d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Install `forgit` in just one click.
| <kbd>Alt</kbd> - <kbd>E</kbd> | Open file in default editor (when possible) |

\* Available when the selection contains a commit hash or a stash ID.
For linux users `FORGIT_COPY_CMD` should be set to make copy work. Example: `FORGIT_COPY_CMD='xclip -selection clipboard'`.
For Linux users `FORGIT_COPY_CMD` should be set to make copy work. Example: `FORGIT_COPY_CMD='xclip -selection clipboard'`.

# ⚙ Options

Expand Down 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 Expand Up @@ -339,7 +339,7 @@ export FORGIT_LOG_FZF_OPTS='

# 📦 Optional dependencies

- [`delta`](https://github.com/dandavison/delta) / [`diff-so-fancy`](https://github.com/so-fancy/diff-so-fancy): For better human readable diffs.
- [`delta`](https://github.com/dandavison/delta) / [`diff-so-fancy`](https://github.com/so-fancy/diff-so-fancy): For better human-readable diffs.

- [`bat`](https://github.com/sharkdp/bat.git): Syntax highlighting for `gitignore`.

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 4d6706d

Please sign in to comment.