Re: [PATCH] git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 24, 2016 at 8:27 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Ville Skyttä <ville.skytta@xxxxxx> 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).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]