]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4253-am-keep-cr-dos.sh
tests: mark tests relying on the current default for `init.defaultBranch`
[thirdparty/git.git] / t / t4253-am-keep-cr-dos.sh
CommitLineData
6d8d8e0d
SH
1#!/bin/sh
2#
3# Copyright (c) 2010 Stefan-W. Hahn
4#
5
6test_description='git-am mbox with dos line ending.
7
8'
334afbc7
JS
9GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
10export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
11
6d8d8e0d
SH
12. ./test-lib.sh
13
14# Three patches which will be added as files with dos line ending.
15
16cat >file1 <<\EOF
17line 1
18EOF
19
20cat >file1a <<\EOF
21line 1
22line 4
23EOF
24
25cat >file2 <<\EOF
26line 1
27line 2
28EOF
29
30cat >file3 <<\EOF
31line 1
32line 2
33line 3
34EOF
35
36test_expect_success 'setup repository with dos files' '
37 append_cr <file1 >file &&
38 git add file &&
39 git commit -m Initial &&
40 git tag initial &&
41 append_cr <file2 >file &&
42 git commit -a -m Second &&
43 append_cr <file3 >file &&
44 git commit -a -m Third
45'
46
47test_expect_success 'am with dos files without --keep-cr' '
48 git checkout -b dosfiles initial &&
49 git format-patch -k initial..master &&
50 test_must_fail git am -k -3 000*.patch &&
51 git am --abort &&
52 rm -rf .git/rebase-apply 000*.patch
53'
54
55test_expect_success 'am with dos files with --keep-cr' '
56 git checkout -b dosfiles-keep-cr initial &&
ce4c7bfc
BL
57 git format-patch -k --stdout initial..master >output &&
58 git am --keep-cr -k -3 output &&
6d8d8e0d
SH
59 git diff --exit-code master
60'
61
62test_expect_success 'am with dos files config am.keepcr' '
63 git config am.keepcr 1 &&
64 git checkout -b dosfiles-conf-keepcr initial &&
ce4c7bfc
BL
65 git format-patch -k --stdout initial..master >output &&
66 git am -k -3 output &&
6d8d8e0d
SH
67 git diff --exit-code master
68'
69
8d8136c3 70test_expect_success 'am with dos files config am.keepcr overridden by --no-keep-cr' '
6d8d8e0d
SH
71 git config am.keepcr 1 &&
72 git checkout -b dosfiles-conf-keepcr-override initial &&
73 git format-patch -k initial..master &&
74 test_must_fail git am -k -3 --no-keep-cr 000*.patch &&
75 git am --abort &&
76 rm -rf .git/rebase-apply 000*.patch
77'
78
79test_expect_success 'am with dos files with --keep-cr continue' '
80 git checkout -b dosfiles-keep-cr-continue initial &&
81 git format-patch -k initial..master &&
82 append_cr <file1a >file &&
83 git commit -m "different patch" file &&
84 test_must_fail git am --keep-cr -k -3 000*.patch &&
85 append_cr <file2 >file &&
86 git add file &&
87 git am -3 --resolved &&
88 git diff --exit-code master
89'
90
8d8136c3 91test_expect_success 'am with unix files config am.keepcr overridden by --no-keep-cr' '
6d8d8e0d
SH
92 git config am.keepcr 1 &&
93 git checkout -b unixfiles-conf-keepcr-override initial &&
94 cp -f file1 file &&
95 git commit -m "line ending to unix" file &&
96 git format-patch -k initial..master &&
97 git am -k -3 --no-keep-cr 000*.patch &&
98 git diff --exit-code -w master
99'
100
101test_done