All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Philippe Blain <levraiphilippeblain@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH] completion: loosen and document the requirement around completing alias
Date: Wed, 20 Sep 2023 11:28:22 -0700	[thread overview]
Message-ID: <xmqqy1h08zsp.fsf_-_@gitster.g> (raw)
In-Reply-To: <pull.1585.v2.git.1694538135853.gitgitgadget@gmail.com> (Philippe Blain via GitGitGadget's message of "Tue, 12 Sep 2023 17:02:15 +0000")

Recently we started to tell users to spell ": git foo ;" with
space(s) around 'foo' for an alias to be completed similarly
to the 'git foo' command.  It however is easy to also allow users to
spell it in a more natural way with the semicolon attached to 'foo',
i.e. ": git foo;".  Also, add a comment to note that 'git' is optional
and writing ": foo;" would complete the alias just fine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * We've discussed this when we reviewed the topic that just hit
   'master'.  Before we forget...

 contrib/completion/git-completion.bash | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git c/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash
index 47fd664ea5..477ef8157a 100644
--- c/contrib/completion/git-completion.bash
+++ w/contrib/completion/git-completion.bash
@@ -28,7 +28,8 @@
 # completion style.  For example '!f() { : git commit ; ... }; f' will
 # tell the completion to use commit completion.  This also works with aliases
 # of form "!sh -c '...'".  For example, "!sh -c ': git commit ; ... '".
-# Be sure to add a space between the command name and the ';'.
+# Note that "git" is optional --- '!f() { : commit; ...}; f' would complete
+# just like the 'git commit' command.
 #
 # If you have a command that is not part of git, but you would still
 # like completion, you can use __git_complete:
@@ -1183,7 +1184,7 @@ __git_aliased_command ()
 			:)	: skip null command ;;
 			\'*)	: skip opening quote after sh -c ;;
 			*)
-				cur="$word"
+				cur="${word%;}"
 				break
 			esac
 		done

  parent reply	other threads:[~2023-09-20 18:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-09 15:49 [PATCH] completion: improve doc for complex aliases Philippe Blain via GitGitGadget
2023-09-10  2:02 ` Eric Sunshine
2023-09-12  1:04 ` Linus Arver
2023-09-12 12:13   ` Philippe Blain
2023-09-12 17:02 ` [PATCH v2] " Philippe Blain via GitGitGadget
2023-09-13  0:58   ` Junio C Hamano
2023-09-14 22:50     ` Linus Arver
2023-09-14 22:33   ` Linus Arver
2023-09-20 18:28   ` Junio C Hamano [this message]
2023-09-20 18:46     ` [PATCH] completion: loosen and document the requirement around completing alias Junio C Hamano
2023-09-22 18:31       ` Linus Arver
2023-09-22 19:49         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy1h08zsp.fsf_-_@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=levraiphilippeblain@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.