mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 15:26:16 -04:00
Allow passing arguments to git rebase (#422)
If non-option arguments are passed to `git forgit rebase`, pass them through directly to `git rebase`, without launching the interactive selector, just like we do for other forgit commands. Along with this, remove possibility to pass files to rebase, as there is no need for that. I assume this was a copy-paste error when the rebase function was introduced in the first place.
This commit is contained in:
parent
0d65efc769
commit
09f17c9032
|
|
@ -725,27 +725,27 @@ _forgit_cherry_pick_from_branch() {
|
||||||
|
|
||||||
_forgit_rebase() {
|
_forgit_rebase() {
|
||||||
_forgit_inside_work_tree || return 1
|
_forgit_inside_work_tree || return 1
|
||||||
local opts graph quoted_files target_commit prev_commit
|
_forgit_contains_non_flags "$@" && { git rebase "$@"; return $?; }
|
||||||
|
local opts graph target_commit prev_commit
|
||||||
graph=()
|
graph=()
|
||||||
[[ $_forgit_log_graph_enable == true ]] && graph=(--graph)
|
[[ $_forgit_log_graph_enable == true ]] && graph=(--graph)
|
||||||
_forgit_rebase_git_opts=()
|
_forgit_rebase_git_opts=()
|
||||||
_forgit_parse_array _forgit_rebase_git_opts "$FORGIT_REBASE_GIT_OPTS"
|
_forgit_parse_array _forgit_rebase_git_opts "$FORGIT_REBASE_GIT_OPTS"
|
||||||
quoted_files=$(_forgit_quote_files "$@")
|
|
||||||
opts="
|
opts="
|
||||||
$FORGIT_FZF_DEFAULT_OPTS
|
$FORGIT_FZF_DEFAULT_OPTS
|
||||||
+s +m --tiebreak=index
|
+s +m --tiebreak=index
|
||||||
--bind=\"ctrl-y:execute-silent($FORGIT yank_sha {})\"
|
--bind=\"ctrl-y:execute-silent($FORGIT yank_sha {})\"
|
||||||
--preview=\"$FORGIT file_preview {} $quoted_files\"
|
--preview=\"$FORGIT file_preview {}\"
|
||||||
$FORGIT_REBASE_FZF_OPTS
|
$FORGIT_REBASE_FZF_OPTS
|
||||||
"
|
"
|
||||||
target_commit=$(
|
target_commit=$(
|
||||||
git log "${graph[@]}" --color=always --format="$_forgit_log_format" "$@" |
|
git log "${graph[@]}" --color=always --format="$_forgit_log_format" |
|
||||||
_forgit_emojify |
|
_forgit_emojify |
|
||||||
FZF_DEFAULT_OPTS="$opts" fzf |
|
FZF_DEFAULT_OPTS="$opts" fzf |
|
||||||
_forgit_extract_sha)
|
_forgit_extract_sha)
|
||||||
if [[ -n "$target_commit" ]]; then
|
if [[ -n "$target_commit" ]]; then
|
||||||
prev_commit=$(_forgit_previous_commit "$target_commit")
|
prev_commit=$(_forgit_previous_commit "$target_commit")
|
||||||
git rebase -i "${_forgit_rebase_git_opts[@]}" "$prev_commit"
|
git rebase -i "${_forgit_rebase_git_opts[@]}" "$@" "$prev_commit"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue