git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 2/3] Makes the bash completion script try *bash* completions before simple, filetype completions when a git completion is not found. If bash, completions aren't available, the default file completions are used. This, behavior was inspired by Mercurial's bash completion script.
@ 2009-01-13 16:10 Ted Pavlic
  2009-01-13 16:38 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Ted Pavlic @ 2009-01-13 16:10 UTC (permalink / raw
  To: Shawn O. Pearce; +Cc: git, Junio C Hamano


Second in a series of patches that make bash completions more robust to
different interactive shell configurations and editors.


[PATCH 2/3] Makes the bash completion script try *bash* completions 
before simple
  filetype completions when a git completion is not found. If bash
  completions aren't available, the default file completions are used. This
  behavior was inspired by Mercurial's bash completion script.


Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
  contrib/completion/git-completion.bash |    9 ++++++---
  1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/contrib/completion/git-completion.bash 
b/contrib/completion/git-completion.bash
index 5d1515c..201f9a6 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1766,13 +1766,16 @@ _gitk ()
  	__git_complete_revlist
  }

-complete -o default -o nospace -F _git git
-complete -o default -o nospace -F _gitk gitk
+complete -o bashdefault -o default -o nospace -F _git git 2>/dev/null \
+	|| complete -o default -o nospace -F _git git
+complete -o bashdefault -o default -o nospace -F _gitk gitk 2>/dev/null \
+	|| complete -o default -o nospace -F _gitk gitk

  # The following are necessary only for Cygwin, and only are needed
  # when the user has tab-completed the executable name and consequently
  # included the '.exe' suffix.
  #
  if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
-complete -o default -o nospace -F _git git.exe
+complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
+	|| complete -o default -o nospace -F _git git.exe
  fi
-- 
1.6.1.87.g15624

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] Makes the bash completion script try *bash* completions before simple, filetype completions when a git completion is not found. If bash, completions aren't available, the default file completions are used. This, behavior was inspired by Mercurial's bash completion script.
  2009-01-13 16:10 [PATCH 2/3] Makes the bash completion script try *bash* completions before simple, filetype completions when a git completion is not found. If bash, completions aren't available, the default file completions are used. This, behavior was inspired by Mercurial's bash completion script Ted Pavlic
@ 2009-01-13 16:38 ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2009-01-13 16:38 UTC (permalink / raw
  To: Ted Pavlic; +Cc: git, Junio C Hamano

Ted Pavlic <ted@tedpavlic.com> wrote:
>
> Second in a series of patches that make bash completions more robust to
> different interactive shell configurations and editors.
>
>
> [PATCH 2/3] Makes the bash completion script try *bash* completions  
> before simple
>  filetype completions when a git completion is not found. If bash
>  completions aren't available, the default file completions are used. This
>  behavior was inspired by Mercurial's bash completion script.

Again, I would have used this as my commit message:

	bash-completion: Try bash completions before file completions

	Try bash completions before any simple file completions
	whenever a git completion is not found.  This may help
	users to complete BLAH BLAH BLAH WHAT THE HECK IS THIS GOOD
	FOR ANYWAY.

	Behavior was inspired by Mercurial's bash completion script.

No ack, because I still don't understand why this is a good thing.
Yes, I could look it up online in the bash docs.  I shouldn't need
to go do research like that to understand the justification for
a change, it should be better explained in the message.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-13 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-13 16:10 [PATCH 2/3] Makes the bash completion script try *bash* completions before simple, filetype completions when a git completion is not found. If bash, completions aren't available, the default file completions are used. This, behavior was inspired by Mercurial's bash completion script Ted Pavlic
2009-01-13 16:38 ` Shawn O. Pearce

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).