summaryrefslogtreecommitdiff
path: root/quilt/patches/fail_on_missing
blob: 7a1a875aa0725777cb3b9f3f069d4ff9a2a808f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  * Make sure that quilt fails when trying to push a non existant patch (ie
    if there is a typo in the serie file) unless -f is provided.
    (Closes: #358875).

Upstream status: they asked for some cleanups, which are done. To be submitted.

---
 quilt/push.in     |    7 +++++++
 test/missing.test |    4 ++++
 2 files changed, 11 insertions(+)

--- a/quilt/push.in
+++ b/quilt/push.in
@@ -184,6 +184,13 @@ add_patch()
 		no_reject_files="-r $tmp"
 	fi
 
+	if [ ! -e "$patch_file" -a -z "$opt_force" ]
+	then
+		printf $"Patch %s does not exist\n" \
+		       "$(print_patch $patch)" >&2
+		return 1
+	fi
+
 	apply_patch $patch "$patch_file"
 	status=$?
 	trap "" SIGINT
--- a/test/missing.test
+++ b/test/missing.test
@@ -5,6 +5,10 @@
 	< missing2.diff
 	
 	$ quilt push -qa
+	> Patch patches/missing1.diff does not exist
+	> Applying patch patches/missing1.diff
+	
+	$ quilt push -qaf
 	> Applying patch patches/missing1.diff
 	> Patch patches/missing1.diff does not exist; applied empty patch
 	> Applying patch patches/missing2.diff