Index: quilt/quilt/test/template-header.test =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ quilt/quilt/test/template-header.test 2005-07-16 00:57:44.904881825 +0200 @@ -0,0 +1,56 @@ +This is a minimal test script that checks that patch template work. +TODO: +- fix the 'ugly hack' +- check that refresh but empty template doesn't create an empty patch + +(To run, type `./run template-header.test' in this directory.) + + $ rm -rf patches + $ mkdir patches + + $ cat > patches/.header + < + < HEADER + < + + $ mkdir d + $ cd d + $ touch file1 + $ quilt new patch1.diff + > Patch %{P}patch1.diff is now on top + + $ quilt add file1 + > File d/file1 added to patch %{P}patch1.diff + + $ echo "This is file one." >> file1 + + $ quilt refresh + > Refreshed patch %{P}patch1.diff + + $ quilt diff | sed -e "s/\\t.*//" + > Index: test/d/file1 + > =================================================================== + > --- /dev/null + > +++ test/d/file1 + > @@ -0,0 +1 @@ + > +This is file one. + + # ugly hack. Is there a way to print a patch with its header? + $ cat ../patches/patch1.diff | sed -e "s/\\t.*//" + > + > HEADER + > + > Index: test/d/file1 + > =================================================================== + > --- /dev/null + > +++ test/d/file1 + > @@ -0,0 +1 @@ + > +This is file one. + + $ quilt pop -qaR + > Removing patch %{P}patch1.diff + > No patches applied + + $ cd .. + $ rm -rf d + $ rm -rf .pc Index: quilt/quilt/quilt/refresh.in =================================================================== --- quilt.orig/quilt/quilt/refresh.in 2005-07-16 00:17:53.972041936 +0200 +++ quilt/quilt/quilt/refresh.in 2005-07-16 00:40:54.825859215 +0200 @@ -288,6 +288,11 @@ cat $tmp_header > $tmp_result fi +if [ ! -e $patch_file ] +then + patch_template_header >> $tmp_result +fi + cat $tmp_patch >> $tmp_result if [ -e $patch_file ] && \ Index: quilt/quilt/scripts/patchfns.in =================================================================== --- quilt.orig/quilt/scripts/patchfns.in 2005-07-15 23:15:37.933315577 +0200 +++ quilt/quilt/scripts/patchfns.in 2005-07-16 00:30:01.853187156 +0200 @@ -761,6 +761,12 @@ eval $C } +patch_template_header() +{ + [ -e $PATCH_TEMPLATE_HEADER ] || return 1 + cat $PATCH_TEMPLATE_HEADER +} + # # If the working directory does not contain a $QUILT_PATCHES directory, # quilt searches for its base directory up the directory tree. If no @@ -810,6 +816,7 @@ SERIES=$QUILT_PATCHES/series fi +PATCH_TEMPLATE_HEADER="$QUILT_PATCHES/.header" DB="$QUILT_PC/applied-patches" if [ -z "$skip_version_check" ] && ! version_check