Re: [PATCH v2 1/4] completion: add 'git history' subcommands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




On Thu, Aug 06, 2026 at 10:27:36PM +0200, Vincent Mailhol wrote:
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index e875787710..7372e2919b 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2137,6 +2137,54 @@ _git_help ()
> 	fi
> }
>
> +__git_history_has_revision ()
> +{
> +	local i
> +
> +	for ((i = __git_cmd_idx + 2; i < cword; i++)); do
> +		case "${words[i]}" in
> +		--empty|--update-refs)
> +			((i++))
> +			;;
This will unfortunately be quite a pain to maintain going forward, as we
now have to be aware of updating this site every single time we add a
new option that accepts a parameter.
I don't really have a good idea for how to fix that reliably though, I
have to admit. Maybe we should just mostly ignore this edge case and
always complete references, unless we have seen a `--`? That can be
checked rather easily via `__git_hash_doubledash`.
That'd still be a huge win compared to the status quo, and if we really
care about making this work properly we can still iterate.
Patrick

[Index of Archives] [Linux Kernel Development] [Gcc Help] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [V4L] [Bugtraq] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [Fedora Users]

(追記) (追記ここまで)
Powered by Linux

AltStyle によって変換されたページ (->オリジナル) /