summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2003-11-27 16:15:40 +0000
committerAndreas Gruenbacher <agruen@suse.de>2003-11-27 16:15:40 +0000
commita3a058b8dc41a2e5d7bb2b813ccb1e389067dcc3 (patch)
treeafc2c7be1ad3340b7051cb95be93a30f7e9a8990
parentb4ea7b77bf697ff6c103bf21132407812d86b26d (diff)
downloadquilt-a3a058b8dc41a2e5d7bb2b813ccb1e389067dcc3.tar.gz
- `quilt fold' did not create directories for additional files,
and the code for recovering from failures was wrong.
-rw-r--r--quilt.changes6
-rw-r--r--quilt/fold.in15
-rw-r--r--test/fold.test18
3 files changed, 25 insertions, 14 deletions
diff --git a/quilt.changes b/quilt.changes
index 9575a96..cf9f2a3 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Nov 27 17:16:48 CET 2003 - agruen@suse.de
+
+- `quilt fold' did not create directories for additional files,
+ and the code for recovering from failures was wrong.
+
+-------------------------------------------------------------------
Tue Nov 25 15:48:37 CET 2003 - agruen@suse.de
- Update quilt paper.
diff --git a/quilt/fold.in b/quilt/fold.in
index 0f1f6e1..2fc226d 100644
--- a/quilt/fold.in
+++ b/quilt/fold.in
@@ -87,12 +87,16 @@ workdir=$(gen_tempfile -d $PWD)
if [ -z "$failed" ]
then
+ # Copy additional files from workdir to the backup directory
+ # For this patch
for file in $(find $workdir -type f -a ! -path "$workdir/.timestamp")
do
- backup_file="$(backup_file_name $top "${file:${#workdir}+1}")"
+ file="${file:${#workdir}+1}"
+ backup_file="$(backup_file_name $top "$file")"
if ! [ -e "$backup_file" ]
then
- if ! ln "$file" "$backup_file"
+ if ! mkdir -p "$(dirname "$backup_file")" ||
+ ! ln "$workdir/$file" "$backup_file"
then
failed=1
break
@@ -102,12 +106,13 @@ then
fi
if [ -n "$failed" ]
then
+ # Restore all files to the state from before applying the patch
for file in $(find $workdir -type f -a ! -path "$workdir/.timestamp")
do
- backup_file="$(backup_file_name $top "${file:${#workdir}+1}")"
- if ! mv -f "$backup_file" "$file"
+ file="${file:${#workdir}+1}"
+ if ! mv -f "$workdir/$file" "$file"
then
- echo $"File ${file:${#workdir}+1} may be corrupted"
+ echo $"File $file may be corrupted"
fi
done
rm -rf $workdir
diff --git a/test/fold.test b/test/fold.test
index b0aeb90..ec0a256 100644
--- a/test/fold.test
+++ b/test/fold.test
@@ -21,8 +21,8 @@
< +++ q/file2.txt
< @@ -1 +0,0 @@
< -This is file2.txt.
- < --- q.orig/file3.txt
- < +++ q/file3.txt
+ < --- q.orig/dir/file3.txt
+ < +++ q/dir/file3.txt
< @@ -0,0 +1 @@
< +This is file3.txt.
@@ -36,22 +36,22 @@
$ quilt fold -q < patches/patch2.diff
$ quilt files
+ > dir/file3.txt
> file1.txt
- > file3.txt
$ quilt diff | sed -e "s/\\t.*//"
+ > Index: d/dir/file3.txt
+ > ===================================================================
+ > --- d.orig/dir/file3.txt
+ > +++ d/dir/file3.txt
+ > @@ -0,0 +1 @@
+ > +This is file3.txt.
> Index: d/file1.txt
> ===================================================================
> --- d.orig/file1.txt
> +++ d/file1.txt
> @@ -0,0 +1 @@
> +This is file1.txt.
- > Index: d/file3.txt
- > ===================================================================
- > --- d.orig/file3.txt
- > +++ d/file3.txt
- > @@ -0,0 +1 @@
- > +This is file3.txt.
$ cd ..
$ rm -rf d