Skip to content

Commit

Permalink
Fix passing multiple arguments to FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS
Browse files Browse the repository at this point in the history
This was broken because all options were passed together as a single string. I modified this to use an array that splits the options instead.
  • Loading branch information
sandr01d committed Nov 19, 2023
1 parent 54a83b7 commit e8effa8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ _forgit_parse_array _forgit_checkout_branch_git_opts "$FORGIT_CHECKOUT_BRANCH_GI
_forgit_checkout_file_git_opts=()
_forgit_parse_array _forgit_checkout_file_git_opts "$FORGIT_CHECKOUT_FILE_GIT_OPTS"

_forgit_checkout_branch_branch_git_opts=()
_forgit_parse_array _forgit_checkout_branch_branch_git_opts "$FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS"

_forgit_pager=${FORGIT_PAGER:-$(git config core.pager || echo 'cat')}
_forgit_show_pager=${FORGIT_SHOW_PAGER:-$(git config pager.show || echo "$_forgit_pager")}
_forgit_diff_pager=${FORGIT_DIFF_PAGER:-$(git config pager.diff || echo "$_forgit_pager")}
Expand Down Expand Up @@ -580,7 +583,7 @@ _forgit_checkout_branch() {
--preview=\"$FORGIT branch_preview {1}\"
$FORGIT_CHECKOUT_BRANCH_FZF_OPTS
"
branch="$(git branch --color=always "${FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS:---all}" | LC_ALL=C sort -k1.1,1.1 -rs |
branch="$(git branch --color=always "${_forgit_checkout_branch_branch_git_opts[@]:---all}" | LC_ALL=C sort -k1.1,1.1 -rs |
FZF_DEFAULT_OPTS="$opts" fzf | awk '{print $1}')"
[[ -z "$branch" ]] && return 1

Expand Down

0 comments on commit e8effa8

Please sign in to comment.