Re: [PATCH 2/5] completion: complete REVERT_HEAD and BISECT_HEAD
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 14, 2023, 20:25 UTC
- Message-ID
- <xmqq4jpiqki4.fsf@gitster.g>
- In-Reply-To
- <f3a47758f9dce20c29ffb776bffaf73e238c20d1.1681495119.git.gitgitgadget@gmail.com>
"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 23 quoted lines
> From: Philippe Blain <levraiphilippeblain@gmail.com> > > The pseudorefs REVERT_HEAD and BISECT_HEAD are not suggested > by the __git_refs function. Add them there. > > Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> > --- > contrib/completion/git-completion.bash | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index dc95c34cc85..bcda376735c 100644 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -767,7 +767,7 @@ __git_refs () > track="" > ;; > *) > - for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do > + for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD; do > case "$i" in > $match*|$umatch*) > if [ -e "$dir/$i" ]; then
This does obvious change to add two completion possibilities reusing exactly the same logic we have been using.
A tangent related to my earlier "didn't we plan to limit them to *_HEAD at some point?" is that we could turn the loop around and do something like
for i in HEAD $(cd "$dir" && echo *_HEAD) do case "$i" in $match*|$umatch*) if test -f "$dir/$i" then ...
which could be a lot more future-proof, once we have such a rule.
But that is a tangent that we should wait until the current series settles.
Thanks.