diff options
author | Jean Delvare <jdelvare@suse.de> | 2012-02-01 21:01:26 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2012-02-01 21:01:26 +0100 |
commit | 1df79c3c1d65c05472fdc08564efefc37c221d25 (patch) | |
tree | 19b78321943cd5c79aa2cd871fa1f525c341c1a0 | |
parent | 08df4ffdf4d2e8b197488fbd07c1b26e9a4dc596 (diff) | |
download | quilt-1df79c3c1d65c05472fdc08564efefc37c221d25.tar.gz |
grep: Accept file names with spaces
This is a continuation of Yasushi SHOJI's initial work of fixing
support for file names with spaces. This time I fixed support in the
grep command. This is particularly important because the grep command
operates on all files in the work tree, even if they aren't touched
by any patch, so the chances that one of them has a space in its name
is greater. As before, no guarantee is made that all options are
covered, but this should be a good starting point.
-rw-r--r-- | quilt.changes | 5 | ||||
-rw-r--r-- | quilt/grep.in | 4 | ||||
-rw-r--r-- | test/space-in-filenames.test | 7 |
3 files changed, 14 insertions, 2 deletions
diff --git a/quilt.changes b/quilt.changes index f160fd0..11dccd6 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Wed Feb 1 21:00:45 CET 2012 - jdelvare@suse.de + +- grep: Accept file names with spaces. + +------------------------------------------------------------------- Wed Feb 1 20:15:01 CET 2012 - jdelvare@suse.de - Makefile.in: Include utilfns when generating source tarball. diff --git a/quilt/grep.in b/quilt/grep.in index 270ba9c..0c32fcf 100644 --- a/quilt/grep.in +++ b/quilt/grep.in @@ -117,8 +117,8 @@ fi find "${myargs[@]:-.}" \( \ -path "./$QUILT_PATCHES/*" -o \ -path "./$QUILT_PC/*" \) -prune -o \ - -type f -print \ -| xargs grep $opt_H "${args[@]}" \ + -type f -print0 \ +| xargs -0 grep $opt_H "${args[@]}" \ | if [ ${#myargs[@]} -eq 0 ]; then sed -e 's,^./,,' else diff --git a/test/space-in-filenames.test b/test/space-in-filenames.test index eb0d035..fa0ddf8 100644 --- a/test/space-in-filenames.test +++ b/test/space-in-filenames.test @@ -77,6 +77,13 @@ $ cat patches/test.diff > -foo > +bar +$ quilt grep bar +> foo bar:bar +$ quilt grep new +> a: b [c]:new line +$ quilt grep " " +> a: b [c]:new line + $quilt remove "a: b [c]" > File a: b [c] removed from patch patches/test.diff |