summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quilt/add.in16
-rw-r--r--quilt/files.in9
-rw-r--r--quilt/remove.in8
-rw-r--r--quilt/scripts/patchfns.in8
-rw-r--r--test/space-in-filenames.test43
5 files changed, 65 insertions, 19 deletions
diff --git a/quilt/add.in b/quilt/add.in
index 373192f..dfd48f8 100644
--- a/quilt/add.in
+++ b/quilt/add.in
@@ -91,21 +91,21 @@ fi
patch=$(find_applied_patch "$opt_patch") || exit 1
status=0
-for file in $*
+for file in "$@"
do
- if ! in_valid_dir $SUBDIR$file
+ if ! in_valid_dir "$SUBDIR$file"
then
status=1
continue
fi
- if file_in_patch $SUBDIR$file $patch
+ if file_in_patch "$SUBDIR$file" $patch
then
printf $"File %s is already in patch %s\n" \
"$SUBDIR$file" "$(print_patch $patch)" >&2
[ $status -ne 1 ] && status=2
continue
fi
- next_patch=$(next_patch_for_file $patch $SUBDIR$file)
+ next_patch=$(next_patch_for_file $patch "$SUBDIR$file")
if [ -n "$next_patch" ]
then
printf $"File %s modified by patch %s\n" \
@@ -114,24 +114,24 @@ do
continue
fi
- if [ -L $SUBDIR$file ]
+ if [ -L "$SUBDIR$file" ]
then
printf $"Cannot add symbolic link %s\n" "$SUBDIR$file" >&2
status=1
continue
fi
- if ! $QUILT_LIB/backup-files -b -s -L -B $QUILT_PC/$patch/ $SUBDIR$file
+ if ! $QUILT_LIB/backup-files -b -s -L -B $QUILT_PC/$patch/ "$SUBDIR$file"
then
printf $"Failed to back up file %s\n" "$SUBDIR$file" >&2
status=1
continue
fi
- if [ -e $SUBDIR$file ]
+ if [ -e "$SUBDIR$file" ]
then
# The original tree may be read-only.
- chmod u+w $SUBDIR$file
+ chmod u+w "$SUBDIR$file"
fi
printf $"File %s added to patch %s\n" \
diff --git a/quilt/files.in b/quilt/files.in
index 033abe0..bbd913c 100644
--- a/quilt/files.in
+++ b/quilt/files.in
@@ -116,6 +116,7 @@ list_files_in_patch()
{
local patch=$1
local status
+ local saved_IFS="$IFS"
if [ -n "$opt_all" ] && [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]
then
@@ -126,7 +127,10 @@ list_files_in_patch()
use_status=yes
fi
# Note: If opt_labels is set, then use_status is not set.
- for file in $(files_in_patch $patch | sort)
+ IFS=
+ echo $(files_in_patch "$patch") |
+ sort |
+ while read file
do
if [ -n "$opt_labels" ]
then
@@ -157,13 +161,14 @@ list_files_in_patch()
echo "$status $file"
fi
done
+ IFS="$saved_IFS"
}
setup_pager
for patch in ${patches[@]}
do
- list_files_in_patch $patch
+ list_files_in_patch "$patch"
done
### Local Variables:
diff --git a/quilt/remove.in b/quilt/remove.in
index a11db0a..96a4e86 100644
--- a/quilt/remove.in
+++ b/quilt/remove.in
@@ -66,9 +66,9 @@ fi
patch=$(find_applied_patch "$opt_patch") || exit 1
status=0
-for file in $*
+for file in "$@"
do
- if ! file_in_patch $SUBDIR$file $patch
+ if ! file_in_patch "$SUBDIR$file" $patch
then
printf $"File %s is not in patch %s\n" \
"$SUBDIR$file" "$(print_patch $patch)" >&2
@@ -76,7 +76,7 @@ do
continue
fi
- next_patch=$(next_patch_for_file $patch $SUBDIR$file)
+ next_patch=$(next_patch_for_file $patch "$SUBDIR$file")
if [ -n "$next_patch" ]
then
printf $"File %s modified by patch %s\n" \
@@ -86,7 +86,7 @@ do
fi
# Restore file from backup
- if ! $QUILT_LIB/backup-files -r -t -s -B $QUILT_PC/$patch/ $SUBDIR$file
+ if ! $QUILT_LIB/backup-files -r -t -s -B $QUILT_PC/$patch/ "$SUBDIR$file"
then
printf $"Failed to remove file %s from patch %s\n" \
"$SUBDIR$file" "$(print_patch $patch)" >&2
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 4d53fbf..9ed4fd1 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -665,11 +665,9 @@ files_in_patch()
if [ -d "$path" ]
then
- local files
- files=( $(find "$path" -type f \
- -a ! -path "$path/.timestamp") ) \
- || return 1
- printf "%s\n" "${files[@]#$path/}"
+ find "$path" -type f \
+ -a ! -path "$path/.timestamp" |
+ sed -e "s:$path/::"
fi
}
diff --git a/test/space-in-filenames.test b/test/space-in-filenames.test
new file mode 100644
index 0000000..bbefe23
--- /dev/null
+++ b/test/space-in-filenames.test
@@ -0,0 +1,43 @@
+$ rm -rf d
+$ mkdir -p d/patches
+$ cd d
+$ quilt new test.diff
+>Patch patches/test.diff is now on top
+
+$ echo foo > foo
+$ quilt add foo
+> File foo added to patch patches/test.diff
+
+$ quilt files
+> foo
+
+$ quilt add "foo bar"
+> File foo bar added to patch patches/test.diff
+
+$ quilt files
+> foo
+> foo bar
+
+$ quilt add "a: b [c]"
+> File a: b [c] added to patch patches/test.diff
+
+$ quilt files
+> a: b [c]
+> foo
+> foo bar
+
+$quilt remove "a: b [c]"
+> File a: b [c] removed from patch patches/test.diff
+
+$ quilt files
+> foo
+> foo bar
+
+$quilt remove "foo bar"
+> File foo bar removed from patch patches/test.diff
+
+$ quilt files
+> foo
+
+$ cd ..
+$ rm -rf d