bugQuilt - Bugs: bug #27111, bash completion of patch names...

 
 
Show feedback again

bug #27111: bash completion of patch names fails

Submitted by:  Martin von Gagern <gagern>
Submitted on:  Sun 26 Jul 2009 08:55:55 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: Daniel Lovasko <dlovasko>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 23 Nov 2011 10:25:46 AM UTC, comment #1:

Over two years without so much as a comment. Ping?

Martin von Gagern <gagern>
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

Martin von Gagern <gagern>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #18478:  gentoo278641a.patch added by gagern (5kB - application/octet-stream - Two patches addressing the issue with different levels of complexity)
file #18479:  gentoo278641b.patch added by gagern (5kB - application/octet-stream - Two patches addressing the issue with different levels of complexity)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by khali (Updated the item)
  • -unavailable- added by gagern (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Jan 2013 05:37:53 PM UTCkhaliAssigned toNone=>dlovasko
    Sun 26 Jul 2009 08:55:55 AM UTCgagernAttached File-=>Added gentoo278641a.patch, #18478
      Attached File-=>Added gentoo278641b.patch, #18479
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup