Hi Andreas,
Le Tuesday 11 February 2014 à 15:12 +0100, Andreas Grünbacher a écrit :
> 2014-02-11 Jean Delvare <[email protected]>:
> > "quilt files" returns a blank line if no files are included in the
> > patch. This could easily break constructs such as "quilt files | wc
> > -l" or "if [ -z "$(quilt files)" ]". Let "quilt files" return nothing
> > at all if there are no files in the patch.
>
> [ -z "$(quilt files)" ] ignores leading/trailing whitespace so it
> doesn't actually care.
Ah, right. I checked that [ -z " " ] returned false and did not
remember that the $() construct itself does the leading/trailing
whitespace stripping. But anyway, the failing "wc -l" is a good enough
reason to fix it IMHO.
> How about getting rid of the echo?
>
> - echo $(files_in_patch "$patch") |
> + files_in_patch "$patch" |
Oh, right, I knew I was missing something. Thanks for pointing it out,
it's much more elegant that way. Not sure what the echo was for in the
first place then...
* * * * *
"quilt files" returns a blank line if no files are included in the
patch. This could easily break constructs such as "quilt files | wc
-l" or "if [ -z "$(quilt files)" ]". Let "quilt files" return nothing
at all if there are no files in the patch.
---
quilt/files.in | 2 +-
test/example1.test | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
--- quilt.orig/quilt/files.in
+++ quilt/quilt/files.in
@@ -128,7 +128,7 @@ list_files_in_patch()
fi
# Note: If opt_labels is set, then use_status is not set.
IFS=
- echo $(files_in_patch "$patch") |
+ files_in_patch "$patch" |
sort |
while read file
do
--- quilt.orig/test/example1.test
+++ quilt/test/example1.test
@@ -12,6 +12,7 @@ http://the-tech.mit.edu/Shakespeare/mids
$ quilt new flower.diff
> Patch %{P}flower.diff is now on top
+ $ quilt files
$ quilt add Oberon.txt
> File Oberon.txt added to patch %{P}flower.diff
--
Jean Delvare
Suse L3 Support
_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev