summaryrefslogtreecommitdiffstats
path: root/test/symlink.test
blob: 4610af6ae6c8eef191426e4c885a0cf35cb491fc (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
	$ mkdir patches

# quilt should not remove symlinks to patch files
	$ echo foo > foo
	$ quilt new test.diff
	> Patch patches/test.diff is now on top

	$ quilt add foo
	> File foo added to patch patches/test.diff

	$ echo "foo changed" > foo
	$ quilt refresh
	> Refreshed patch patches/test.diff

# Setup a symlink
	$ mv patches/test.diff .
	$ ln -s ../test.diff patches/test.diff
	$ readlink patches/test.diff
	> ../test.diff

# Test the refresh
	$ echo "foo changed 2" > foo
	$ quilt refresh --no-index -p ab
	> Refreshed patch patches/test.diff

	$ readlink patches/test.diff
	> ../test.diff

# Test the refresh --backup
	$ echo "foo changed 3" > foo
	$ quilt refresh --backup --no-index -p ab
	> Refreshed patch patches/test.diff

	$ readlink patches/test.diff
	> ../test.diff

	$ cat patches/test.diff
	> --- a/foo
	> +++ b/foo
	> @@ -1 +1 @@
	> -foo
	> +foo changed 3

	$ readlink patches/test.diff~
	$ echo %{?}
	> 1

	$ cat patches/test.diff~
	> --- a/foo
	> +++ b/foo
	> @@ -1 +1 @@
	> -foo
	> +foo changed 2

# Test the refresh when target is read-only
	$ chmod -w test.diff
	$ echo "foo changed 4" > foo
	$ quilt refresh --no-index -p ab
	> Refreshed patch patches/test.diff

	$ readlink patches/test.diff
	$ echo %{?}
	> 1

	$ cat patches/test.diff
	> --- a/foo
	> +++ b/foo
	> @@ -1 +1 @@
	> -foo
	> +foo changed 4

# Test the refresh --backup when target is read-only
	$ mv patches/test.diff .
	$ ln -s ../test.diff patches/test.diff
	$ chmod -w test.diff

	$ echo "foo changed 5" > foo
	$ quilt refresh --backup --no-index -p ab
	> Refreshed patch patches/test.diff

	$ readlink patches/test.diff
	$ echo %{?}
	> 1

	$ cat patches/test.diff
	> --- a/foo
	> +++ b/foo
	> @@ -1 +1 @@
	> -foo
	> +foo changed 5

	$ readlink patches/test.diff~
	$ echo %{?}
	> 1

	$ cat patches/test.diff~
	> --- a/foo
	> +++ b/foo
	> @@ -1 +1 @@
	> -foo
	> +foo changed 4