From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25406 invoked by alias); 17 May 2015 17:57:09 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35165 Received: (qmail 9576 invoked from network); 17 May 2015 17:57:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= content-transfer-encoding:content-type:content-type:in-reply-to :references:subject:subject:mime-version:user-agent:from:from :date:date:message-id:received:received; s=postfix2; t= 1431885426; bh=YdbUXFmq1U8me9xeFTaZg1K9ZbAMtlSxcoR+Ih5r3EU=; b=R RdWKNlzvdeyKVhortyrj0ryE413vgmx22bp2U/dX2bpmG1PGuAYRnyJTNk+6ydyX 3z5sXuYjJ9g3zfXsvr68HTnWbW25jvFAAclYTzQIK+yFaedwl/EyIzsowUA0H8pc /Na/F+/vheGHe8yEHMR98j7+F+IrQGcEx0XlcUAq1Y= Message-ID: <5558D672.9090803@thequod.de> Date: Sun, 17 May 2015 19:57:06 +0200 From: Daniel Hahler User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Re: [PATCH] completion: git: fix __git_commit_objects/__git_recent_commits References: <1431884273-17095-1-git-send-email-genml+zsh-workers@thequod.de> In-Reply-To: <1431884273-17095-1-git-send-email-genml+zsh-workers@thequod.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I will push this later with the "return $ret" mentioned by Bart in 35162. On 17.05.2015 19:37, Daniel Hahler wrote: > From: Daniel Hahler > > $pipestatus for `: foo` appears to be 0 always. > Explicitly declare `$commits` as associative array, and assign it > normally. > > Without this, "git checkout" in a non-git directory would complete " ", > but not result in a note/error about not being in a git dir. > --- > Completion/Unix/Command/_git | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git > index ed23b39..da852ef 100644 > --- a/Completion/Unix/Command/_git > +++ b/Completion/Unix/Command/_git > @@ -5649,11 +5649,11 @@ __git_heads_remote () { > (( $+functions[__git_commit_objects] )) || > __git_commit_objects () { > local gitdir expl start > - declare -a commits > + declare -A commits > > # Note: the after-the-colon part must be unique across the entire array; > # see workers/34768 > - : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -20 --format='%h:\\\[%h\\\]\ %s')"}} > + commits=(${(f)"$(_call_program commits git --no-pager log -20 --format='%h:\\\[%h\\\]\ %s')"}) > __git_command_successful $pipestatus || return 1 > > _describe -V -t commits 'commit object name' commits || _guard '[[:xdigit:]](#c,40)' 'commit object name' > @@ -5662,11 +5662,12 @@ __git_commit_objects () { > (( $+functions[__git_recent_commits] )) || > __git_recent_commits () { > local gitdir expl start > - declare -a descr tags heads commits > + declare -a descr tags heads > + declare -A commits > local i j k > > # Careful: most %d will expand to the empty string. Quote properly! > - : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s')"}}" > + commits=(${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s')"}) > __git_command_successful $pipestatus || return 1 > > for i j k in "$commits[@]" ; do > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iD8DBQFVWNZyfAK/hT/mPgARAjzOAKDy/2q75fIHMrD3b0wLXqjNyKBxawCePJR4 yHupBK2rR7GLl/7jzctuN9w= =74Ni -----END PGP SIGNATURE-----