[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] handling empty new files
From: |
Joe Green |
Subject: |
Re: [Quilt-dev] handling empty new files |
Date: |
Wed, 10 Aug 2005 10:18:33 -0700 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050317) |
Joe Green wrote:
Jean Delvare wrote:
On 2005-08-10, Jerome Lacoste wrote:
I am having problems to generate a patch with a new empty file.
Wow, great timing. I've just been updating the version of quilt we
use locally, and I have a patch for this that I was planning to
propose to add to quilt.
As you found out, this is caused by a limitations in diff (or more
precisely, in the diff output format, which is even worse). As long as
quilt uses diff to generate patch files, there's anything we can do.
Actually, there is. The problem is that quilt forces the "-E" option
when it invokes patch. If this option is not specified, patch can
determine the difference between an empty file and a removed or added
file by looking at the patch file names (/dev/null "to" file means
removed, on "from" file means added) or the file timestamps (epoch
means removed/added).
The only downside I can see is that some people may not be generating
patches with the correct headers (e.g., not using "-N" option to
diff). quilt generates correct headers on the patches it creates or
refreshes.
I would suggest removing the "-E" on patch application, and letting
users add it to "QUILT_PATCH_OPTS" if they wish to.
I've attached a sample patch to remove this option. Warning: I've
just updated this to 0.42; I haven't tested it yet, but it's fairly
straightforward.
D'oh! Forgot the attachment. :) Thanks, Martin, for pointing this out.
--
Joe Green <address@hidden>
MontaVista Software, Inc.
Source: MontaVista Software, Inc
Type: Enhancement
Description:
Remove forcing of patch "-E" option. Not needed, and removing it
allows creation of true empty files.
Index: quilt-0.42/quilt/diff.in
===================================================================
--- quilt-0.42.orig/quilt/diff.in
+++ quilt-0.42/quilt/diff.in
@@ -353,7 +353,7 @@ then
then
if ! cat_file $patch_file \
| @PATCH@ -d $workdir $QUILT_PATCH_OPTS $patch_args \
- --no-backup-if-mismatch -Ef \
+ --no-backup-if-mismatch -f \
>/dev/null 2>/dev/null
then
# Generating a relative diff for a subset of files in
Index: quilt-0.42/quilt/fold.in
===================================================================
--- quilt-0.42.orig/quilt/fold.in
+++ quilt-0.42/quilt/fold.in
@@ -83,7 +83,7 @@ fi
trap "failed=1" SIGINT
workdir=$(gen_tempfile -d $PWD)
address@hidden@ $QUILT_PATCH_OPTS -p$opt_strip_level $silent --backup
--prefix="$workdir/" -E \
address@hidden@ $QUILT_PATCH_OPTS -p$opt_strip_level $silent --backup
--prefix="$workdir/" \
|| failed=1
if [ -z "$failed" ]
Index: quilt-0.42/quilt/pop.in
===================================================================
--- quilt-0.42.orig/quilt/pop.in
+++ quilt-0.42/quilt/pop.in
@@ -130,7 +130,7 @@ check_for_pending_changes()
if ! cat_file $patch_file \
| @PATCH@ -d $workdir $QUILT_PATCH_OPTS \
$(patch_args $patch) \
- --no-backup-if-mismatch -E \
+ --no-backup-if-mismatch \
>/dev/null 2>/dev/null
then
if ! [ -e $QUILT_PC/$patch ]
Index: quilt-0.42/quilt/push.in
===================================================================
--- quilt-0.42.orig/quilt/push.in
+++ quilt-0.42/quilt/push.in
@@ -99,19 +99,19 @@ apply_patch()
| @PATCH@ $QUILT_PATCH_OPTS $(patch_args $patch) \
--backup --prefix="$QUILT_PC/$patch/" \
$no_reject_files \
- -E $silent $force_apply 2>&1
+ $silent $force_apply 2>&1
elif [ "${patch_file:(-4)}" = ".bz2" ]
then
bzip2 -cd $patch_file \
| @PATCH@ $QUILT_PATCH_OPTS $(patch_args $patch) \
--backup --prefix="$QUILT_PC/$patch/" \
$no_reject_files \
- -E $silent $force_apply 2>&1
+ $silent $force_apply 2>&1
else
@PATCH@ $QUILT_PATCH_OPTS $(patch_args $patch) \
--backup --prefix="$QUILT_PC/$patch/" \
$no_reject_files \
- -E $silent $force_apply -i $patch_file 2>&1
+ $silent $force_apply -i $patch_file 2>&1
fi
}