blob: d53aa4222ea3c1405247e07d62fc8efed83daa5d [file] [log] [blame]
Junio C Hamano52be5fc2005-09-04 15:40:18 -07001#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
Junio C Hamano5be60072007-07-02 22:52:14 -07006test_description='git apply should not get confused with rename/copy.
Junio C Hamano52be5fc2005-09-04 15:40:18 -07007
8'
9
Ævar Arnfjörð Bjarmasonf54f48f2021-10-31 00:24:18 +020010
11TEST_PASSES_SANITIZE_LEAK=true
Junio C Hamano52be5fc2005-09-04 15:40:18 -070012. ./test-lib.sh
13
14# setup
15
Junio C Hamanob7a036b2006-07-26 11:01:07 -070016mkdir -p klibc/arch/x86_64/include/klibc
Junio C Hamano52be5fc2005-09-04 15:40:18 -070017
18cat >klibc/arch/x86_64/include/klibc/archsetjmp.h <<\EOF
19/*
20 * arch/x86_64/include/klibc/archsetjmp.h
21 */
22
23#ifndef _KLIBC_ARCHSETJMP_H
24#define _KLIBC_ARCHSETJMP_H
25
26struct __jmp_buf {
27 unsigned long __rbx;
28 unsigned long __rsp;
29 unsigned long __rbp;
30 unsigned long __r12;
31 unsigned long __r13;
32 unsigned long __r14;
33 unsigned long __r15;
34 unsigned long __rip;
35};
36
37typedef struct __jmp_buf jmp_buf[1];
38
39#endif /* _SETJMP_H */
40EOF
Junio C Hamanoa9a3e822008-07-09 19:58:23 -070041cat >klibc/README <<\EOF
42This is a simple readme file.
43EOF
Junio C Hamano52be5fc2005-09-04 15:40:18 -070044
45cat >patch <<\EOF
46diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/cris/klibc/archsetjmp.h
47similarity index 76%
48copy from klibc/arch/x86_64/include/klibc/archsetjmp.h
49copy to include/arch/cris/klibc/archsetjmp.h
50--- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
51+++ b/include/arch/cris/klibc/archsetjmp.h
52@@ -1,21 +1,24 @@
53 /*
54- * arch/x86_64/include/klibc/archsetjmp.h
55+ * arch/cris/include/klibc/archsetjmp.h
56 */
Junio C Hamanoa6080a02007-06-07 00:04:01 -070057
Junio C Hamano52be5fc2005-09-04 15:40:18 -070058 #ifndef _KLIBC_ARCHSETJMP_H
59 #define _KLIBC_ARCHSETJMP_H
Junio C Hamanoa6080a02007-06-07 00:04:01 -070060
Junio C Hamano52be5fc2005-09-04 15:40:18 -070061 struct __jmp_buf {
62- unsigned long __rbx;
63- unsigned long __rsp;
64- unsigned long __rbp;
65- unsigned long __r12;
66- unsigned long __r13;
67- unsigned long __r14;
68- unsigned long __r15;
69- unsigned long __rip;
70+ unsigned long __r0;
71+ unsigned long __r1;
72+ unsigned long __r2;
73+ unsigned long __r3;
74+ unsigned long __r4;
75+ unsigned long __r5;
76+ unsigned long __r6;
77+ unsigned long __r7;
78+ unsigned long __r8;
79+ unsigned long __sp;
80+ unsigned long __srp;
81 };
Junio C Hamanoa6080a02007-06-07 00:04:01 -070082
Junio C Hamano52be5fc2005-09-04 15:40:18 -070083 typedef struct __jmp_buf jmp_buf[1];
Junio C Hamanoa6080a02007-06-07 00:04:01 -070084
Junio C Hamano52be5fc2005-09-04 15:40:18 -070085-#endif /* _SETJMP_H */
86+#endif /* _KLIBC_ARCHSETJMP_H */
87diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/m32r/klibc/archsetjmp.h
88similarity index 66%
89rename from klibc/arch/x86_64/include/klibc/archsetjmp.h
90rename to include/arch/m32r/klibc/archsetjmp.h
91--- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
92+++ b/include/arch/m32r/klibc/archsetjmp.h
93@@ -1,21 +1,21 @@
94 /*
95- * arch/x86_64/include/klibc/archsetjmp.h
96+ * arch/m32r/include/klibc/archsetjmp.h
97 */
Junio C Hamanoa6080a02007-06-07 00:04:01 -070098
Junio C Hamano52be5fc2005-09-04 15:40:18 -070099 #ifndef _KLIBC_ARCHSETJMP_H
100 #define _KLIBC_ARCHSETJMP_H
Junio C Hamanoa6080a02007-06-07 00:04:01 -0700101
Junio C Hamano52be5fc2005-09-04 15:40:18 -0700102 struct __jmp_buf {
103- unsigned long __rbx;
104- unsigned long __rsp;
105- unsigned long __rbp;
106+ unsigned long __r8;
107+ unsigned long __r9;
108+ unsigned long __r10;
109+ unsigned long __r11;
110 unsigned long __r12;
111 unsigned long __r13;
112 unsigned long __r14;
113 unsigned long __r15;
114- unsigned long __rip;
115 };
Junio C Hamanoa6080a02007-06-07 00:04:01 -0700116
Junio C Hamano52be5fc2005-09-04 15:40:18 -0700117 typedef struct __jmp_buf jmp_buf[1];
Junio C Hamanoa6080a02007-06-07 00:04:01 -0700118
Junio C Hamano52be5fc2005-09-04 15:40:18 -0700119-#endif /* _SETJMP_H */
120+#endif /* _KLIBC_ARCHSETJMP_H */
Junio C Hamanoa9a3e822008-07-09 19:58:23 -0700121diff --git a/klibc/README b/klibc/README
122--- a/klibc/README
123+++ b/klibc/README
124@@ -1,1 +1,4 @@
125 This is a simple readme file.
126+And we add a few
127+lines at the
128+end of it.
129diff --git a/klibc/README b/klibc/arch/README
130copy from klibc/README
131copy to klibc/arch/README
132--- a/klibc/README
133+++ b/klibc/arch/README
134@@ -1,1 +1,3 @@
135 This is a simple readme file.
136+And we copy it to one level down, and
137+add a few lines at the end of it.
Junio C Hamano52be5fc2005-09-04 15:40:18 -0700138EOF
139
Junio C Hamano5be60072007-07-02 22:52:14 -0700140find klibc -type f -print | xargs git update-index --add --
Junio C Hamano52be5fc2005-09-04 15:40:18 -0700141
Junio C Hamano5be60072007-07-02 22:52:14 -0700142test_expect_success 'check rename/copy patch' 'git apply --check patch'
Junio C Hamano52be5fc2005-09-04 15:40:18 -0700143
Junio C Hamano5be60072007-07-02 22:52:14 -0700144test_expect_success 'apply rename/copy patch' 'git apply --index patch'
Junio C Hamano52be5fc2005-09-04 15:40:18 -0700145
146test_done