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