File tree Expand file tree Collapse file tree 11 files changed +229
-0
lines changed
Expand file tree Collapse file tree 11 files changed +229
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ test_description=' git am not losing options'
4+ . ./test-lib.sh
5+
6+ tm=" $TEST_DIRECTORY /t4252"
7+
8+ test_expect_success setup '
9+ cp "$tm/file-1-0" file-1 &&
10+ cp "$tm/file-2-0" file-2 &&
11+ git add file-1 file-2 &&
12+ test_tick &&
13+ git commit -m initial &&
14+ git tag initial
15+ '
16+
17+ test_expect_success ' interrupted am --whitespace=fix' '
18+ rm -rf .git/rebase-apply &&
19+ git reset --hard initial &&
20+ test_must_fail git am --whitespace=fix "$tm"/am-test-1-? &&
21+ git am --skip &&
22+ grep 3 file-1 &&
23+ grep "^Six$" file-2
24+ '
25+
26+ test_expect_success ' interrupted am -C1' '
27+ rm -rf .git/rebase-apply &&
28+ git reset --hard initial &&
29+ test_must_fail git am -C1 "$tm"/am-test-2-? &&
30+ git am --skip &&
31+ grep 3 file-1 &&
32+ grep "^Three$" file-2
33+ '
34+
35+ test_expect_success ' interrupted am -p2' '
36+ rm -rf .git/rebase-apply &&
37+ git reset --hard initial &&
38+ test_must_fail git am -p2 "$tm"/am-test-3-? &&
39+ git am --skip &&
40+ grep 3 file-1 &&
41+ grep "^Three$" file-2
42+ '
43+
44+ test_expect_success ' interrupted am -C1 -p2' '
45+ rm -rf .git/rebase-apply &&
46+ git reset --hard initial &&
47+ test_must_fail git am -p2 -C1 "$tm"/am-test-4-? &&
48+ cat .git/rebase-apply/apply_opt_extra &&
49+ git am --skip &&
50+ grep 3 file-1 &&
51+ grep "^Three$" file-2
52+ '
53+
54+ test_done
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Three
4+
5+ Application of this should be rejected because the first line in the
6+ context does not match.
7+
8+ diff --git i/file-1 w/file-1
9+ index 06e567b..10f8342 100644
10+ --- i/file-1
11+ +++ w/file-1
12+ @@ -1,6 +1,6 @@
13+ One
14+ 2
15+ -3
16+ +Three
17+ 4
18+ 5
19+ 6
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Six
4+
5+ Applying this patch with --whitespace=fix should lose
6+ the trailing whitespace after "Six".
7+
8+ diff --git i/file-2 w/file-2
9+ index 06e567b..b6f3a16 100644
10+ --- i/file-2
11+ +++ w/file-2
12+ @@ -1,7 +1,7 @@
13+ 1
14+ 2
15+ -3
16+ +Three
17+ 4
18+ 5
19+ -6
20+ +Six
21+ 7
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Three
4+
5+ Application of this should be rejected even with -C1 because the
6+ preimage line in the context does not match.
7+
8+ diff --git i/file-1 w/file-1
9+ index 06e567b..10f8342 100644
10+ --- i/file-1
11+ +++ w/file-1
12+ @@ -1,6 +1,6 @@
13+ 1
14+ 2
15+ -Tres
16+ +Three
17+ 4
18+ 5
19+ 6
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Six
4+
5+ Applying this patch with -C1 should be successful even though
6+ the first line in the context does not match.
7+
8+ diff --git i/file-2 w/file-2
9+ index 06e567b..b6f3a16 100644
10+ --- i/file-2
11+ +++ w/file-2
12+ @@ -1,7 +1,7 @@
13+ One
14+ 2
15+ -3
16+ +Three
17+ 4
18+ 5
19+ -6
20+ +Six
21+ 7
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Three
4+
5+ Application of this should be rejected even with -p2 because the
6+ preimage line in the context does not match.
7+
8+ diff --git i/junk/file-1 w/junk/file-1
9+ index 06e567b..10f8342 100644
10+ --- i/junk/file-1
11+ +++ w/junk/file-1
12+ @@ -1,6 +1,6 @@
13+ 1
14+ 2
15+ -Tres
16+ +Three
17+ 4
18+ 5
19+ 6
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Six
4+
5+ Applying this patch with -p2 should be successful even though
6+ the patch is against a wrong level.
7+
8+ diff --git i/junk/file-2 w/junk/file-2
9+ index 06e567b..b6f3a16 100644
10+ --- i/junk/file-2
11+ +++ w/junk/file-2
12+ @@ -1,7 +1,7 @@
13+ 1
14+ 2
15+ -3
16+ +Three
17+ 4
18+ 5
19+ -6
20+ +Six
21+ 7
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Three
4+
5+ Application of this should be rejected even with -C1 -p2 because
6+ the preimage line in the context does not match.
7+
8+ diff --git i/junk/file-1 w/junk/file-1
9+ index 06e567b..10f8342 100644
10+ --- i/junk/file-1
11+ +++ w/junk/file-1
12+ @@ -1,6 +1,6 @@
13+ 1
14+ 2
15+ -Tres
16+ +Three
17+ 4
18+ 5
19+ 6
Original file line number Diff line number Diff line change 1+ From: A U Thor <au.thor@example.com>
2+ Date: Thu Dec 4 16:00:00 2008 -0800
3+ Subject: Six
4+
5+ Applying this patch with -C1 -p2 should be successful even though
6+ the patch is against a wrong level and the first context line does
7+ not match.
8+
9+ diff --git i/junk/file-2 w/junk/file-2
10+ index 06e567b..b6f3a16 100644
11+ --- i/junk/file-2
12+ +++ w/junk/file-2
13+ @@ -1,7 +1,7 @@
14+ One
15+ 2
16+ -3
17+ +Three
18+ 4
19+ 5
20+ -6
21+ +Six
22+ 7
Original file line number Diff line number Diff line change 1+ 1
2+ 2
3+ 3
4+ 4
5+ 5
6+ 6
7+ 7
You can’t perform that action at this time.
0 commit comments