Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FORGIT_STASH_SHOW_PREVIEW_GIT_OPTS #389

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,20 @@ For linux users `FORGIT_COPY_CMD` should be set to make copy work. Example: `FOR
Options can be set via environment variables. They have to be **exported** in
order to be recognized by `forgit`.

For instance, if you want to order branches in `gcb` by the last committed date you could:
For instance:

- if you want to order branches in `gcb` by the last committed date, you could:

```shell
export FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS='--sort=-committerdate'
```

- if you want to see a preview of the stashed items in `gss` preview, you could:

```shell
export FORGIT_STASH_SHOW_PREVIEW_GIT_OPTS="--patch-with-stat --stat-count=10"
```

## shell aliases

You can change the default aliases by defining these variables below.
Expand Down Expand Up @@ -243,7 +251,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