git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ville Skyttä" <ville.skytta@iki.fi>
To: Junio C Hamano <gitster@pobox.com>
Cc: "SZEDER Gábor" <szeder@ira.uka.de>, git@vger.kernel.org
Subject: Re: [PATCH] git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION
Date: Mon, 6 Jun 2016 19:31:38 +0300	[thread overview]
Message-ID: <CABr9L5CQeL6iaTh-=G8sfWuygqgpj50mxBaOSL6ihS6x91F3UA@mail.gmail.com> (raw)
In-Reply-To: <xmqqshx75psw.fsf@gitster.mtv.corp.google.com>

On Tue, May 24, 2016 at 8:27 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ville Skyttä <ville.skytta@iki.fi> writes:
>
>> When the shell is in "nounset" or "set -u" mode, referencing unset or
>> null variables results in an error. Protect $ZSH_VERSION and
>> $BASH_VERSION against that.
>>       local ps1_expanded=yes
>> -     [ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
>> -     [ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no
>> +     [ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
>> +     [ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no
>
> I wonder if we can teach t9903 to run (at least) some parts of the
> completion script under "set -u" to catch these automatically without
> a report from an end user.
>
> With the attached "just started to scratch the surface" patch to
> test-lib.sh and fix by Ville to the git-prompt.sh script, we find
> another one.
>
>     ...contrib/completion/git-prompt.sh: line 481: short_sha: unbound variable
>
> Ville, I think you want to take the "git-prompt.sh" part from the
> following and replace it with your patch.

Hm, I'm not entirely sure what I was expected to do, but I took the
short_sha bit, added it to my patch (modifying to be in line with the
style of the rest of the file), and submitted a superseding patch with
the subject "[PATCH 1/2] git-prompt.sh: Don't error on null
${ZSH,BASH}_VERSION, $short_sha" (and there's no part 2/2 coming, that
was a user error).

      parent reply	other threads:[~2016-06-06 16:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24  8:31 [PATCH] git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION Ville Skyttä
2016-05-24 17:11 ` Junio C Hamano
2016-05-24 17:27 ` Junio C Hamano
2016-05-24 19:53   ` Junio C Hamano
2016-06-06 16:31   ` Ville Skyttä [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CABr9L5CQeL6iaTh-=G8sfWuygqgpj50mxBaOSL6ihS6x91F3UA@mail.gmail.com' \
    --to=ville.skytta@iki.fi \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=szeder@ira.uka.de \
    /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.
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).