quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] Re: Bugfix for insertion of patch at beginning of series


From: Joe Green
Subject: [Quilt-dev] Re: Bugfix for insertion of patch at beginning of series
Date: Thu, 25 Aug 2005 15:13:55 -0700
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

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 <address@hidden>
MontaVista Software, Inc.
Source: MontaVista Software, Inc. <address@hidden>
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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]