Description: Return 2 (instead of 1) when there is nothing to do
 This is mandatory to differentiate "error" and "everything's done".
 .
 This really ease the scripting around quilt, eg in patchsys-quilt.mk 
 .
 It used to works this way, and was changed upstream in commit 
 188c7dac15a72c437c47664d3162b9f13844fe88 for quilt version 0.43. This
 regression was the result of a code factorization.
 .
 This patch also contains the documentation update, by adding a EXIT
 STATUS to the man page.
Bug-Debian: http://bugs.debian.org/358792 (return 2 on NO-OP)
Bug-Debian: http://bugs.debian.org/587001 (document exit status)
Forwarded: Submitted 2013-01-18
Changelog:
 - 2012-12-19: Submitted upstream
 - 2013-01-18: Upstream asked for changes and documentation
 - 2013-01-18: new version subitted upstream
Last-Update: 2013-01-18


---
 doc/quilt.1.in            |   11 ++++++++---
 quilt/push.in             |    2 +-
 quilt/scripts/patchfns.in |    8 ++++----
 3 files changed, 13 insertions(+), 8 deletions(-)

Index: b/quilt/push.in
===================================================================
--- a/quilt/push.in
+++ b/quilt/push.in
@@ -363,7 +363,7 @@
 	[ -z "$opt_all" ] && number=1
 fi
 
-stop_at_patch=$(find_unapplied_patch "$stop_at_patch") || exit 1
+stop_at_patch=$(find_unapplied_patch "$stop_at_patch") || exit
 
 [ -z "$opt_verbose" ] && silent_unless_verbose=-s
 [ -n "$opt_force" ] && opt_leave_rejects=1
Index: b/quilt/scripts/patchfns.in
===================================================================
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -483,7 +483,7 @@
 		else
 			printf $"No series file found\n" >&2
 		fi
-		return 1
+		return 2
 	fi
 
 	echo "$patch"
@@ -588,7 +588,7 @@
 	        then
 			printf $"Patch %s is currently applied\n" \
 				"$(print_patch $patch)" >&2
-               		return 1
+               		return 2
 	        fi
 		echo "$patch"
 	else
@@ -598,13 +598,13 @@
 		then
 			patch_after "$start"
 		else
-			find_first_patch || return 1
+			find_first_patch || return 2
 		fi
 		if [ $? -ne 0 ]
 		then
 			printf $"File series fully applied, ends at patch %s\n" \
 				"$(print_patch $start)" >&2
-			return 1
+			return 2
 		fi
 	fi
 }
Index: b/doc/quilt.1.in
===================================================================
--- a/doc/quilt.1.in
+++ b/doc/quilt.1.in
@@ -122,6 +122,13 @@
 
 Print the version number and exit immediately.
 
+.SH EXIT STATUS
+
+The exit status is 0 if the subcommand was successfully executed, and
+1 in case of error. An exit status of 2 denotes that quilt did not do
+anything to complete the command; This happens for example when asking
+to push when the whole stack is already pushed. This behavior is
+intended to ease the scripting around quilt.
 
 .SH EXAMPLE OF WORKING TREE
 
@@ -141,9 +148,7 @@
 .RE
 .fam T
 
-.SH EXAMPLE
-
-Please refer to the pdf documentation for an example.
+Please refer to the pdf documentation for a full example of use.
 
 .SH CONFIGURATION FILE
 
