All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gummerer <t.gummerer@gmail.com>
To: git@vger.kernel.org
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"Thomas Gummerer" <t.gummerer@gmail.com>
Subject: [PATCH 1/3] completion: rename save_opts to default_opts for stash
Date: Tue, 17 Apr 2018 22:29:43 +0100	[thread overview]
Message-ID: <20180417212945.24002-2-t.gummerer@gmail.com> (raw)
In-Reply-To: <20180417212945.24002-1-t.gummerer@gmail.com>

'git stash save' is deprecated, but we still call the options for
completion 'save_opts'.  Simply renaming them to 'push_opts' is not
ideal because for example '--message foo' can't be passed directly to
'git stash', as non-option arguments are not allowed, and foo would be
treated as one.

Completing '--message' in 'git stash --<tab>' would end up being quite
confusing for the user.  Therefore name them 'default_opts', and keep
treating --message specially for 'git stash push'.

The ulterior motive for renaming 'save_opts' is that in the next
commit we're going to stop completing 'git stash save', so 'save_opts'
would be the only remaining thing referring to 'git stash save', which
would probably be confusing for future readers of this code.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
 contrib/completion/git-completion.bash | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a757073945..39c123926c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2773,16 +2773,16 @@ _git_show_branch ()
 
 _git_stash ()
 {
-	local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
+	local default_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
 	local subcommands='push save list show apply clear drop pop create branch'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
 		case "$cur" in
 		--*)
-			__gitcomp "$save_opts"
+			__gitcomp "$default_opts"
 			;;
 		*)
-			if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
+			if [ -z "$(__git_find_on_cmdline "$default_opts")" ]; then
 				__gitcomp "$subcommands"
 			fi
 			;;
@@ -2790,10 +2790,10 @@ _git_stash ()
 	else
 		case "$subcommand,$cur" in
 		push,--*)
-			__gitcomp "$save_opts --message"
+			__gitcomp "$default_opts --message"
 			;;
 		save,--*)
-			__gitcomp "$save_opts"
+			__gitcomp "$default_opts"
 			;;
 		apply,--*|pop,--*)
 			__gitcomp "--index --quiet"
-- 
2.17.0.252.gfe0a9eaf31


  reply	other threads:[~2018-04-17 21:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 21:29 [PATCH 0/3] completion: improvements for git stash Thomas Gummerer
2018-04-17 21:29 ` Thomas Gummerer [this message]
2018-04-17 21:29 ` [PATCH 2/3] completion: stop completing 'save' as stash subcommand Thomas Gummerer
2018-04-17 21:29 ` [PATCH 3/3] completion: make stash -p and alias for stash push -p Thomas Gummerer
2018-04-18  8:32 ` [PATCH 0/3] completion: improvements for git stash Junio C Hamano
2018-04-18 21:15   ` Thomas Gummerer
2018-04-19 23:25 ` [PATCH v2 0/2] " Thomas Gummerer
2018-04-19 23:25   ` [PATCH v2 1/2] completion: stop showing 'save' for stash by default Thomas Gummerer
2018-04-20  5:17     ` Duy Nguyen
2018-04-22 20:36       ` Thomas Gummerer
2018-04-19 23:25   ` [PATCH v2 2/2] completion: make stash -p and alias for stash push -p Thomas Gummerer
2018-04-20  1:38   ` [PATCH v2 0/2] completion: improvements for git stash 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=20180417212945.24002-2-t.gummerer@gmail.com \
    --to=t.gummerer@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=szeder.dev@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.