Joe Green wrote:
When you create a new patch at the beginning of a series, this patch is inserted at the beginning of the series file, regardless of any directives or comments.  If inserted before directives, this can break future "quilt setup" operations on the series file.  The attached patch changes insert_in_series to insert the patch just before the first existing patch in the series file.  An alternative would be to change to looking for the "next patch", and always insert right before that.
Yes, this seems to be a simpler fix.  I've implemented this alternative in the attached patch.

-- 
Joe Green <[EMAIL PROTECTED]>
MontaVista Software, Inc.


Source: MontaVista Software, Inc. <[EMAIL PROTECTED]>
Type: Defect Fix
Disposition: submit to http://savannah.nongnu.org/projects/quilt

Don't insert first patch before any initial directives or comments.

Index: quilt-0.42/scripts/patchfns.in
===================================================================
--- quilt-0.42.orig/scripts/patchfns.in
+++ quilt-0.42/scripts/patchfns.in
@@ -191,7 +191,7 @@ patch_in_series()
 insert_in_series()
 {
 	local patch=$1 patch_args=$2
-	local top=$(top_patch) tmpfile
+	local next=$(patches_after "$(top_patch)" | head -n 1) tmpfile
 
 	if [ -n "$patch_args" ]
 	then
@@ -200,12 +200,12 @@ insert_in_series()
 
 	tmpfile=$(gen_tempfile) || return 1
 	mkdir -p $(dirname $SERIES)
-	if [ -n "$top" ]
+	if [ -n "$next" ]
 	then
 		@AWK@ '
-				{ print }
-		/^'"$(quote_re $top)"'([ \t]|$)/ \
+		/^'"$(quote_re $next)"'([ \t]|$)/ \
 				{ print "'"$patch$patch_args"'" }
+				{ print }
 		' $SERIES > $tmpfile
 		status=$?
 		if [ $status -ne 0 ]
@@ -214,11 +214,11 @@ insert_in_series()
 			return 1
 		fi
 	else
-		echo "$patch$patch_args" > $tmpfile
 		if [ -e $SERIES ]
 		then
-			cat $SERIES >> $tmpfile
+			cat $SERIES > $tmpfile
 		fi
+		echo "$patch$patch_args" >> $tmpfile
 	fi
 	cat $tmpfile > $SERIES
 	rm -f $tmpfile
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to