Raw
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Junio C Hamano
4 #
5
6 test_description='git apply should not get confused with rename/copy.
7
8 '
9
10
11 . ./test-lib.sh
12
13 # setup
14
15 mkdir -p klibc/arch/x86_64/include/klibc
16
17 cat >klibc/arch/x86_64/include/klibc/archsetjmp.h <<\EOF
18 /*
19 * arch/x86_64/include/klibc/archsetjmp.h
20 */
21
22 #ifndef _KLIBC_ARCHSETJMP_H
23 #define _KLIBC_ARCHSETJMP_H
24
25 struct __jmp_buf {
26 unsigned long __rbx;
27 unsigned long __rsp;
28 unsigned long __rbp;
29 unsigned long __r12;
30 unsigned long __r13;
31 unsigned long __r14;
32 unsigned long __r15;
33 unsigned long __rip;
34 };
35
36 typedef struct __jmp_buf jmp_buf[1];
37
38 #endif /* _SETJMP_H */
39 EOF
40 cat >klibc/README <<\EOF
41 This is a simple readme file.
42 EOF
43
44 cat >patch <<\EOF
45 diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/cris/klibc/archsetjmp.h
46 similarity index 76%
47 copy from klibc/arch/x86_64/include/klibc/archsetjmp.h
48 copy to include/arch/cris/klibc/archsetjmp.h
49 --- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
50 +++ b/include/arch/cris/klibc/archsetjmp.h
51 @@ -1,21 +1,24 @@
52 /*
53 - * arch/x86_64/include/klibc/archsetjmp.h
54 + * arch/cris/include/klibc/archsetjmp.h
55 */
56
57 #ifndef _KLIBC_ARCHSETJMP_H
58 #define _KLIBC_ARCHSETJMP_H
59
60 struct __jmp_buf {
61 - unsigned long __rbx;
62 - unsigned long __rsp;
63 - unsigned long __rbp;
64 - unsigned long __r12;
65 - unsigned long __r13;
66 - unsigned long __r14;
67 - unsigned long __r15;
68 - unsigned long __rip;
69 + unsigned long __r0;
70 + unsigned long __r1;
71 + unsigned long __r2;
72 + unsigned long __r3;
73 + unsigned long __r4;
74 + unsigned long __r5;
75 + unsigned long __r6;
76 + unsigned long __r7;
77 + unsigned long __r8;
78 + unsigned long __sp;
79 + unsigned long __srp;
80 };
81
82 typedef struct __jmp_buf jmp_buf[1];
83
84 -#endif /* _SETJMP_H */
85 +#endif /* _KLIBC_ARCHSETJMP_H */
86 diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/m32r/klibc/archsetjmp.h
87 similarity index 66%
88 rename from klibc/arch/x86_64/include/klibc/archsetjmp.h
89 rename to include/arch/m32r/klibc/archsetjmp.h
90 --- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
91 +++ b/include/arch/m32r/klibc/archsetjmp.h
92 @@ -1,21 +1,21 @@
93 /*
94 - * arch/x86_64/include/klibc/archsetjmp.h
95 + * arch/m32r/include/klibc/archsetjmp.h
96 */
97
98 #ifndef _KLIBC_ARCHSETJMP_H
99 #define _KLIBC_ARCHSETJMP_H
100
101 struct __jmp_buf {
102 - unsigned long __rbx;
103 - unsigned long __rsp;
104 - unsigned long __rbp;
105 + unsigned long __r8;
106 + unsigned long __r9;
107 + unsigned long __r10;
108 + unsigned long __r11;
109 unsigned long __r12;
110 unsigned long __r13;
111 unsigned long __r14;
112 unsigned long __r15;
113 - unsigned long __rip;
114 };
115
116 typedef struct __jmp_buf jmp_buf[1];
117
118 -#endif /* _SETJMP_H */
119 +#endif /* _KLIBC_ARCHSETJMP_H */
120 diff --git a/klibc/README b/klibc/README
121 --- a/klibc/README
122 +++ b/klibc/README
123 @@ -1,1 +1,4 @@
124 This is a simple readme file.
125 +And we add a few
126 +lines at the
127 +end of it.
128 diff --git a/klibc/README b/klibc/arch/README
129 copy from klibc/README
130 copy to klibc/arch/README
131 --- a/klibc/README
132 +++ b/klibc/arch/README
133 @@ -1,1 +1,3 @@
134 This is a simple readme file.
135 +And we copy it to one level down, and
136 +add a few lines at the end of it.
137 EOF
138
139 find klibc -type f -print | xargs git update-index --add --
140
141 test_expect_success 'check rename/copy patch' 'git apply --check patch'
142
143 test_expect_success 'apply rename/copy patch' 'git apply --index patch'
144
145 test_done