File quilt-files-return-nothing-if-there-are-no-files.patch of Package quilt.4649

From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 14 Feb 2014 15:52:57 +0100
Subject: files: Return nothing if there are no files
Patch-mainline: yes
Git-commit: 4d8358ae52ce574920c7f3aba7453f305fabf1ba
References: bnc#872719

"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". Let "quilt files" return nothing at all if there are no files in
the patch.

diff --git a/quilt/files.in b/quilt/files.in
index 6e107ee..355fa21 100644
--- a/quilt/files.in
+++ b/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
diff --git a/test/example1.test b/test/example1.test
index ec73b81..7eaa228 100644
--- a/test/example1.test
+++ b/test/example1.test
@@ -12,6 +12,7 @@ http://the-tech.mit.edu/Shakespeare/midsummer/full.html
 	$ 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
 
openSUSE Build Service is sponsored by