From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18984 invoked by alias); 23 Sep 2014 10:24:37 -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: 33221 Received: (qmail 23053 invoked from network); 23 Sep 2014 10:24:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f156d0000063c7-0c-542148035fcc Date: Tue, 23 Sep 2014 11:14:26 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: perforce completion patch Message-id: <20140923111426.391eaf61@pwslap01u.europe.root.pri> In-reply-to: <20140916203525.119cd15f@pws-pc.ntlworld.com> References: <1410810987.1055986.167801549.1F9D6403@webmail.messagingengine.com> <20140916203525.119cd15f@pws-pc.ntlworld.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4NV1mD8UQg/WLFSwONj9kcmD0WHXw A1MAYxSXTUpqTmZZapG+XQJXxqFjn1kKfglV9Ky2bmB8xNfFyMkhIWAi8XXnERYIW0ziwr31 bF2MXBxCAksZJf4+/s8E4Sxnkvj/fiUTSBWLgKpE86RPYDabgKHE1E2zGUFsEQFxibNrz4NN EhZQk9jf9Y8VxOYVsJc4uXIHWD2ngJVEy9UfYHEhgXqJG1smMYPY/AL6Elf/QsyUAKqfeeUM I0SvoMSPyffAZjILaEls3tbECmHLS2xe85Z5AqPALCRls5CUzUJStoCReRWjaGppckFxUnqu oV5xYm5xaV66XnJ+7iZGSAh+2cG4+JjVIUYBDkYlHl6PNQohQqyJZcWVuYcYJTiYlUR4+xUV Q4R4UxIrq1KL8uOLSnNSiw8xMnFwSjUwetzTS1nXrb2PWVTd5FtsxYRzah+l7Jsq/708dN1V 37JkOid387S922oO+cYLbFjUJSB+SayQ33JCuOgD1vt79W8L3L+R5jKz/nbG3opb59NmZd3f +lYj3sF6yvLU9cZvp2x1fmplr+fzaaLL3k7TV+/tD4pXhNe8K15f1JtgEvBdzO3rkrZ7SizF GYmGWsxFxYkATEEgjx8CAAA= On Tue, 16 Sep 2014 20:35:25 +0100 Peter Stephenson wrote: > On Mon, 15 Sep 2014 15:56:27 -0400 > Anthony Heading wrote: > > I've had the following small patch for perforce completion sitting > > around for a while, it > > tried to fix e.g. the completion of "foo" when doing "p4 add > > foo/bar.cpp". That said, > > it runs against the goal of the surrounding comments which aim to skip > > directories; I > > couldn't work out though why that would ever be desirable. > > ... it might simply be a case (as well as changing the glob) of removing > the spurious "&& -z $dodirs" (which is true because of the way the > caller works but confusing) and modifying the following comment to say > we always complete directories and hence ignore the -td flag in that > branch. This gives us the following, which shouldn't materially change the behaviour of the original patch. diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 8398702..db91e11 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -1231,10 +1231,15 @@ _perforce_files() { # "subdirs:subdirectory search:_perforce_subdirs" ) _alternative $altfiles - elif [[ -n $unmaintained && -z $dodirs ]]; then - # a la _cvs_nonentried_files: directories are never maintained, - # so skip 'em. Unmaintained files can't be integrated, opened - # or resolved, so treat as exclusive (just as well, since + elif [[ -n $unmaintained ]]; then + # As directories are always umaintained, but may contain files + # we want to add, we'll always complete directories here. That's + # neater than the alternative of excluding them here and requesting + # them separately in the caller. The only client for this + # branch is currently 'p4 add'. + # + # Unmaintained files can't be integrated, opened + # or resolved, so treat as exclusive to other options (just as well, since # this bit's messy). local MATCH MBEGIN MEND local -a omitpats @@ -1253,7 +1258,7 @@ _perforce_files() { [[ $#omitpats -eq 1 && $omitpats[1] = '' ]] && omitpats=() if (( ${#omitpats} )); then - _path_files -g "*~(*/|)(${(j:|:)~omitpats})(D.)" + _path_files -g "*~(*/|)(${(j:|:)~omitpats})(D)" else _path_files fi pws