feat: support commit ref parameters for glo. #85

This commit is contained in:
Wenxuan Zhang 2020-04-17 12:29:21 +08:00
parent 590e77ca07
commit bd67dcbddd
2 changed files with 4 additions and 3 deletions

View file

@ -169,7 +169,7 @@ FORGIT_STASH_FZF_OPTS='
## Tips
- Hit `q` to quit from full screen preview any time.
- Commands like `glo`, `gd`, `gcf` and `gclean` accept path arguments to restrain the items listed in fzf(eg, `glo main.go test.go`, `gclean output/`).
- Commands like `glo`, `gd`, `gcf` and `gclean` accept arguments to restrain the items listed in fzf(eg, `glo develop`, `glo f738479..188a849b -- main.go`, `gclean output/` etc.).
- `gd` supports specifying revision(eg, `gd HEAD~`, `gd v1.0 README.md`).
- Call `gi` with arguments to get the wanted `.gitignore` contents directly(eg, `gi cmake c++`).

View file

@ -11,8 +11,9 @@ forgit_pager=$(git config core.pager || echo 'cat')
# git commit viewer
forgit::log() {
forgit::inside_work_tree || return 1
local cmd opts graph
cmd="echo {} |grep -Eo '[a-f0-9]+' |head -1 |xargs -I% git show --color=always % $* | $forgit_pager"
local cmd opts graph files
files=$(sed -nE 's/.* -- (.*)/\1/p' <<< "$*")
cmd="echo {} |grep -Eo '[a-f0-9]+' |head -1 |xargs -I% git show --color=always % -- $files | $forgit_pager"
opts="
$FORGIT_FZF_DEFAULT_OPTS
+s +m --tiebreak=index