Sun 26 Jul 2009 08:55:55 AM UTC, original submission:
The bash completion from quilt-0.48 or current git fails to complete patch names with app-bash-4.0. This is due to the fact that the completion function uses "quilt series", "quilt applied" and similar internally, which in turn output the paths of the patch files relative to the current working directory, instead of simply the file names as are usually used.
So the possible completions start with "patches/", "../../patches/" or something similar, depending on how deep in the tree you currently are. If you changed $QUILT_PATCHES, that directory will of course change as well. Completion using these full paths will work, but isn't what users would expect. It also isn't what the list of possible completions prints; it seems that this list does strip directory names from its output. So a listed completion doesn't work when typed, which is very irritating.
Steps to reproduce:
1. mkdir foo
2. unset QUILT_PATCHES
3. cd foo
4. mkdir patches
5. quilt new foo.patch
6. quilt new bar.diff
7. quilt header <press tab twice here>
-a -h -r
--backup bar.diff --strip-diffstat
-e foo.patch --strip-trailing-whitespace
8. quilt header f<press tab here>
<no completion at all!!!>
9. quilt series
patches/foo.patch
patches/bar.diff
I guess the solution would be to pipe the output of all those internall quilt patch listing commands through something that strips directory names, like
sed -e 's:.*/::'
The attached gentoo278641a.patch implements this.
Of course this doesn't work when using subdirectories inside the $QUILT_PATCHES directory. To work with those as well, the sed would have to specifically look for a sequence of zero or more "../" followed by $QUILT_PATCHES, possibly followed by "/". A matching sed command would be something like the following one:
sed -e "s:^\\(\\.\\./\\)*${QUILT_PATCHES:-patches}/\\?::"
The attached gentoo278641b.patch implements this.
Strictly speaking, the QUILT_PATCHES directory would have to be escaped, to avoid special interpretation of any regular expression symbols. But I don't know how to express this easily, and I doubt that's worth the effort, as most QUILT_PATCHES directories should be fairly simple, and special treatment of a dot shouldn't hurt.
Also strictly speaking there should be some handling of ~/.quiltrc, the --quiltrc command line option, and so on. So finding the correct patch names can be almost arbitrarily complex. I won't expect a perfect fix, but a mostly working fix.
I originally reported this issue as http://bugs.gentoo.org/278641
|