Debian Codegraph @

tests/filterdiff-inplace1/run-test

raw
1 #!/bin/sh
2
3 # This is a filterdiff(1) testcase.
4 # Test: --in-place option with --include filter
5
6 . ${top_srcdir-.}/tests/common.sh
7
8 cat << "EOF" > test.patch
9 --- a/file1.txt 2023-01-01 00:00:00.000000000 +0000
10 +++ b/file1.txt 2023-01-01 00:00:01.000000000 +0000
11 @@ -1,3 +1,3 @@
12 line 1
13 -line 2
14 +line 2 modified
15 line 3
16 --- a/file2.txt 2023-01-01 00:00:00.000000000 +0000
17 +++ b/file2.txt 2023-01-01 00:00:01.000000000 +0000
18 @@ -1,2 +1,2 @@
19 -old content
20 +new content
21 another line
22 EOF
23
24 # Test --in-place with --include
25 ${FILTERDIFF} --include="*file1*" --in-place test.patch || exit 1
26
27 # Check that file was modified in place and contains only file1.txt
28 cmp - test.patch << "EOF" || exit 1
29 --- a/file1.txt 2023-01-01 00:00:00.000000000 +0000
30 +++ b/file1.txt 2023-01-01 00:00:01.000000000 +0000
31 @@ -1,3 +1,3 @@
32 line 1
33 -line 2
34 +line 2 modified
35 line 3
36 EOF