mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
Merge pull request #193 from sandr01d/grc
Fixed: grc fails when commit is preceded by anything else than '* '
This commit is contained in:
commit
eed197948c
|
|
@ -300,7 +300,7 @@ forgit::checkout::commit() {
|
||||||
forgit::revert::commit() {
|
forgit::revert::commit() {
|
||||||
forgit::inside_work_tree || return 1
|
forgit::inside_work_tree || return 1
|
||||||
[[ $# -ne 0 ]] && { git revert "$@"; return $?; }
|
[[ $# -ne 0 ]] && { git revert "$@"; return $?; }
|
||||||
local cmd opts files preview commits
|
local cmd opts files preview commits IFS
|
||||||
cmd="git log --graph --color=always --format='$forgit_log_format' $* $forgit_emojify"
|
cmd="git log --graph --color=always --format='$forgit_log_format' $* $forgit_emojify"
|
||||||
opts="
|
opts="
|
||||||
$FORGIT_FZF_DEFAULT_OPTS
|
$FORGIT_FZF_DEFAULT_OPTS
|
||||||
|
|
@ -309,13 +309,14 @@ forgit::revert::commit() {
|
||||||
"
|
"
|
||||||
files=$(sed -nE 's/.* -- (.*)/\1/p' <<< "$*") # extract files parameters for `git show` command
|
files=$(sed -nE 's/.* -- (.*)/\1/p' <<< "$*") # extract files parameters for `git show` command
|
||||||
preview="echo {} |grep -Eo '[a-f0-9]+' |head -1 |xargs -I% git show --color=always % -- $files | $forgit_show_pager"
|
preview="echo {} |grep -Eo '[a-f0-9]+' |head -1 |xargs -I% git show --color=always % -- $files | $forgit_show_pager"
|
||||||
commits="$(eval "$cmd" |
|
# shellcheck disable=2207
|
||||||
|
IFS=$'\n' commits=($(eval "$cmd" |
|
||||||
FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" -m |
|
FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" -m |
|
||||||
grep -Eo '^\*\s[a-f0-9]+' |
|
sed 's/^[^a-f^0-9]*\([a-f0-9]*\).*/\1/'))
|
||||||
cut -c 3- |
|
[ ${#commits[@]} -eq 0 ] && return 1
|
||||||
tr $'\n' ' ')"
|
for commit in "${commits[@]}"; do
|
||||||
[[ -z "$commits" ]] && return 1
|
git revert "$commit"
|
||||||
eval "git revert $commits"
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# git ignore generator
|
# git ignore generator
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue