diff mbox series

[2/5] completion: complete REVERT_HEAD and BISECT_HEAD

Message ID f3a47758f9dce20c29ffb776bffaf73e238c20d1.1681495119.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit 30778803e90244379801ef38d155702b5a297d74
Headers show
Series Document 'AUTO_MERGE' and more special refs | expand

Commit Message

Philippe Blain April 14, 2023, 5:58 p.m. UTC
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(-)

Comments

Junio C Hamano April 14, 2023, 8:25 p.m. UTC | #1
"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> 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.
diff mbox series

Patch

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