From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27791 invoked by alias); 22 Jun 2017 20:39:34 -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: 41346 Received: (qmail 416 invoked from network); 22 Jun 2017 20:39:34 -0000 X-Qmail-Scanner-Diagnostics: from hahler.de by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(188.40.33.212):SA:0(0.0/5.0):. Processed in 0.764524 secs); 22 Jun 2017 20:39:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: genml+zsh-workers@thequod.de X-Qmail-Scanner-Mime-Attachments: |signature.asc| X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.hahler.de designates 188.40.33.212 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:subject:subject :received:received; s=postfix2; t=1498163574; bh=8vdy0rRuPCEeFW/ 1qdHXZuWAcEdlmfDQu6MXeY8D6dc=; b=D+JPxZB/yKMDKJAHLBIfDhDN2+jgkFf TJI7tj2xWnj7U5cHZBhw7Dmm4L7VDANnzX7+JUEh3Zfr7DI0FjIWPuehlBhM2VL8 bdICFPaHEb1DmaWNKSdVg3cp3+64qO7Kil4/Lbf4FJCQ/FmVJEpYTYMg4hO124be Ts5KT3ugo1zo= Subject: Re: [PATCH] Functions/Misc/relative: use -q with cd To: zsh-workers@zsh.org References: <20170427203537.13535-1-genml+zsh-workers@thequod.de> <20170429170700.GA14300@fujitsu.shahaf.local2> From: Daniel Hahler Message-ID: <173fb4eb-4df7-a99d-7c49-9afca89b22bf@thequod.de> Date: Thu, 22 Jun 2017 22:32:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170429170700.GA14300@fujitsu.shahaf.local2> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ocN0H2Qkqo1pxqM8G1D7c5xR1hxuCcR8A" --ocN0H2Qkqo1pxqM8G1D7c5xR1hxuCcR8A Content-Type: multipart/mixed; boundary="pV46C2fDIwR3j9C6QQV662kkiXXrwoTfq"; protected-headers="v1" From: Daniel Hahler To: zsh-workers@zsh.org Message-ID: <173fb4eb-4df7-a99d-7c49-9afca89b22bf@thequod.de> Subject: Re: [PATCH] Functions/Misc/relative: use -q with cd References: <20170427203537.13535-1-genml+zsh-workers@thequod.de> <20170429170700.GA14300@fujitsu.shahaf.local2> In-Reply-To: <20170429170700.GA14300@fujitsu.shahaf.local2> --pV46C2fDIwR3j9C6QQV662kkiXXrwoTfq Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 29.04.2017 19:07, Daniel Shahaf wrote: >> +++ b/Functions/Misc/relative >> @@ -8,8 +8,8 @@ emulate -L zsh || return 1 >> -1=3D$(cd $1; pwd -r) >> -2=3D$(cd $2; pwd -r) >> +1=3D$(cd -q $1; pwd -r) >> +2=3D$(cd -q $2; pwd -r) >=20 > Would =C2=AB1=3D${1:P}=C2=BB be equivalent? (If it is, it saves a fork= =2E) Looks like it, I will adjust the patch before committing anything. On 29.04.2017 21:47, Bart Schaefer wrote: > On Apr 29, 5:07pm, Daniel Shahaf wrote: > } > } Pre-existing problem: should the function check that cd succeeded? >=20 > Aside from stderr messing up the display, are there any consequences > for the completion result if failure is detected rather than ignored? After looking closer at it, I think it would be better if it would work w= ith non-existing files/dirs instead. My use case is to make files that are relative to the .git dir relative t= o $PWD: for f in $files; do relfiles+=3D($(relative $gitdir/$f $PWD)) done And there it might be that the file does not exist anymore, since it was = deleted. I would still like to get the relative path in that case. But then the magic of changing the first argument into a dir based on if = it is a file will not work anymore obviously. --pV46C2fDIwR3j9C6QQV662kkiXXrwoTfq-- --ocN0H2Qkqo1pxqM8G1D7c5xR1hxuCcR8A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQS1psIggp+uXWnrnKN8Ar+FP+Y+AAUCWUwpdgAKCRB8Ar+FP+Y+ AB0RAJ0RXZbpyKivcPvmfUSvzT2RQm56PgCgrgrh4X2IAXmUkwqxQrOYSUeqsBg= =9cCs -----END PGP SIGNATURE----- --ocN0H2Qkqo1pxqM8G1D7c5xR1hxuCcR8A--