# (C) 2011-2025 magicant

# Completion script for the "git-cherry-pick" command.
# Supports Git 2.48.1.

function completion/git-cherry-pick {
        WORDS=(git cherry-pick "${WORDS[2,-1]}")
        command -f completion//reexecute
}

function completion/git::cherry-pick:arg {

        OPTIONS=( #>#
        "--abort; end suspended cherry-picking and restore the original state"
        "--allow-empty; allow commits that make no change"
        "--allow-empty-message"
        "--cleanup:; specify the way the message is cleaned up"
        "--continue; resume suspended cherry-picking"
        "e --edit; reedit the message"
        "--empty:; specify how to handle already-merged commits"
        "--ff; fast-forward if possible"
        "S:: --gpg-sign::; sign commits using GPG"
        "--keep-redundant-commits; don't omit already-merged commits"
        "m: --mainline:; apply diffs from the nth parent"
        "n --no-commit; don't commit the result automatically"
        "--no-gpg-sign; don't sign commits using GPG"
        "--quit; end suspended cherry-picking and keep the current state"
        "r; don't include the original commit ID in the message"
        "s --signoff; add a \"signed-off-by\" line to the message"
        "--strategy:; specify the merge strategy"
        "X: --strategy-option:; specify a strategy-specific option"
        "x; include the original commit ID in the message"
        ) #<#

        command -f completion//parseoptions -n
        case $ARGOPT in
                (-)
                        command -f completion//completeoptions
                        ;;
                (--cleanup)
                        command -f completion/git::--cleanup:arg
                        ;;
                (--empty)
                        command -f completion/git::--empty:arg
                        ;;
                (S|--gpg-sign)
                        command -f completion/git::--gpg-sign:arg
                        ;;
#               (m|--mainline)
#                       ;;
                (X|--strategy*)
                        if command -vf completion/git::merge:compopt >/dev/null 2>&1 ||
                                        . -AL completion/git-merge; then
                                command -f completion/git::merge:compopt
                        fi
                        ;;
                ('')
                        command -f completion/git::completeref range=true
                        ;;
        esac

}


# vim: set ft=sh ts=8 sts=8 sw=8 et:
