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 klibc/arch/x86_64/include/klibc
15
16cat >klibc/arch/x86_64/include/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
39cat >klibc/README <<\EOF
40This is a simple readme file.
41EOF
42
43cat >patch <<\EOF
44diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/cris/klibc/archsetjmp.h
45similarity index 76%
46copy from klibc/arch/x86_64/include/klibc/archsetjmp.h
47copy to include/arch/cris/klibc/archsetjmp.h
48--- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
49+++ b/include/arch/cris/klibc/archsetjmp.h
50@@ -1,21 +1,24 @@
51 /*
52- * arch/x86_64/include/klibc/archsetjmp.h
53+ * arch/cris/include/klibc/archsetjmp.h
54 */
55
56 #ifndef _KLIBC_ARCHSETJMP_H
57 #define _KLIBC_ARCHSETJMP_H
58
59 struct __jmp_buf {
60- unsigned long __rbx;
61- unsigned long __rsp;
62- unsigned long __rbp;
63- unsigned long __r12;
64- unsigned long __r13;
65- unsigned long __r14;
66- unsigned long __r15;
67- unsigned long __rip;
68+ unsigned long __r0;
69+ unsigned long __r1;
70+ unsigned long __r2;
71+ unsigned long __r3;
72+ unsigned long __r4;
73+ unsigned long __r5;
74+ unsigned long __r6;
75+ unsigned long __r7;
76+ unsigned long __r8;
77+ unsigned long __sp;
78+ unsigned long __srp;
79 };
80
81 typedef struct __jmp_buf jmp_buf[1];
82
83-#endif /* _SETJMP_H */
84+#endif /* _KLIBC_ARCHSETJMP_H */
85diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/m32r/klibc/archsetjmp.h
86similarity index 66%
87rename from klibc/arch/x86_64/include/klibc/archsetjmp.h
88rename to include/arch/m32r/klibc/archsetjmp.h
89--- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
90+++ b/include/arch/m32r/klibc/archsetjmp.h
91@@ -1,21 +1,21 @@
92 /*
93- * arch/x86_64/include/klibc/archsetjmp.h
94+ * arch/m32r/include/klibc/archsetjmp.h
95 */
96
97 #ifndef _KLIBC_ARCHSETJMP_H
98 #define _KLIBC_ARCHSETJMP_H
99
100 struct __jmp_buf {
101- unsigned long __rbx;
102- unsigned long __rsp;
103- unsigned long __rbp;
104+ unsigned long __r8;
105+ unsigned long __r9;
106+ unsigned long __r10;
107+ unsigned long __r11;
108 unsigned long __r12;
109 unsigned long __r13;
110 unsigned long __r14;
111 unsigned long __r15;
112- unsigned long __rip;
113 };
114
115 typedef struct __jmp_buf jmp_buf[1];
116
117-#endif /* _SETJMP_H */
118+#endif /* _KLIBC_ARCHSETJMP_H */
119diff --git a/klibc/README b/klibc/README
120--- a/klibc/README
121+++ b/klibc/README
122@@ -1,1 +1,4 @@
123 This is a simple readme file.
124+And we add a few
125+lines at the
126+end of it.
127diff --git a/klibc/README b/klibc/arch/README
128copy from klibc/README
129copy to klibc/arch/README
130--- a/klibc/README
131+++ b/klibc/arch/README
132@@ -1,1 +1,3 @@
133 This is a simple readme file.
134+And we copy it to one level down, and
135+add a few lines at the end of it.
136EOF
137
138find klibc -type f -print | xargs git update-index --add --
139
140test_expect_success 'check rename/copy patch' 'git apply --check patch'
141
142test_expect_success 'apply rename/copy patch' 'git apply --index patch'
143
144test_done