Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: perforce completion patch



On Mon, 15 Sep 2014 15:56:27 -0400
Anthony Heading <anthony@xxxxxxxx> 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.

The line you've changed is handling the case of unmaintained files
requested (-tu => unmaintained=1) without directories being requested
(no -td => dodirs='').  This is what the p4 add completion currently does,
but it probably does need to complete directories.  p4 add is the only case
where -tu is passed in.  So it probably doesn't make sense to test for
-z $dodirs there.

What I can't remember and can't test at the moment without a lot of
fiddling is whether that means the code in that function is supposed to
work by adding unmaintained files and directories in some other branch
-- but I doubt it because that seems to be the only branch explicitly
checking for unmaintained files.

So 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.

Of course this isn't going to be smart enough to add only directories
that contain unmaintained files but that fits with other uses of
directory completion which give you the opportunity of completing files
rather than the assurance they're there.

pws



Messages sorted by: Reverse Date, Date, Thread, Author