git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Pavlic <ted@tedpavlic.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] Simplest update to bash completions to prevent unbounded variable errors
Date: Tue, 13 Jan 2009 10:30:56 -0500	[thread overview]
Message-ID: <496CB3B0.7010605@tedpavlic.com> (raw)
In-Reply-To: <20090113152047.GO10179@spearce.org>

>> Another try at fixing bash completions in "set -u" environments.
> I agree with Junio; setting -u in your interactive shell is as bad
> as export CDPATH.  Its crazy.

This whole series of patches was inspired by a group of workstations at 
a university that set -u by default for all users.

Additionally, doesn't "set -u" make tcsh users feel more at home in 
bash? Certainly other shells have this same behavior in their 
interactive modes.

>> Additionally added some comments and omitted things like Vim modelines.
>
> These are orthogonal to the -u corrections.  They should be in a
> different patch.  The comments are wecome.  The '#!bash' looks like
> a good idea.  But a vim specific modeline, I don't like, for the
> reasons Junio has already stated.

OK. Can do.

>> -	if [ -z "$1" ]; then
>> +	if [ $# -eq 0 ] || [ -z "$1" ]; then
>
> This is one of those places where [ -z "${1-}" ] is likely easier

That was a mistake. I missed that hunk. I meant to use the ${1-}.

>> +		if [ $# -gt 0 ]&&  [ -n "$1" ]; then
>
> Eh, I'd rather see [ -n "${1-}" ] over the&&  test.

Again, my mistake. It was late and I missed it.


>> +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
>
> Why are we switching to bashdefault?  Is this an unrelated change
> from the -u stuff and should go into its own commit, with its own
> justification?

Ok.

 From what I understand, normal bash completion is like setting "-o 
bashdefault -o default". That is, it tries the bash completions first 
before going to the filename completion. This change makes it so that 
git jumps back to bash completion if nothing git-specific is found. If 
nothing bash-specific is found, it will go back to standard default 
filename completion.

--Ted



-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

  reply	other threads:[~2009-01-13 15:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13  4:58 [PATCH] Simplest update to bash completions to prevent unbounded variable errors Ted Pavlic
2009-01-13 15:20 ` Shawn O. Pearce
2009-01-13 15:30   ` Ted Pavlic [this message]
2009-01-13 15:33     ` Shawn O. Pearce

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=496CB3B0.7010605@tedpavlic.com \
    --to=ted@tedpavlic.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.org \
    /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 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 NNTP newsgroup(s).