1 |
nelchael 08/07/01 06:34:13 |
2 |
|
3 |
Added: mercurial-1.0.1-87c704ac92d4-git-patch.patch |
4 |
Log: |
5 |
Add patch to fix git patches handling. |
6 |
(Portage version: 2.2_rc1/cvs/Linux 2.6.25-tuxonice-r5 x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 dev-util/mercurial/files/mercurial-1.0.1-87c704ac92d4-git-patch.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/mercurial/files/mercurial-1.0.1-87c704ac92d4-git-patch.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/mercurial/files/mercurial-1.0.1-87c704ac92d4-git-patch.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: mercurial-1.0.1-87c704ac92d4-git-patch.patch |
15 |
=================================================================== |
16 |
changeset: 6758:87c704ac92d4 |
17 |
user: Brendan Cully <brendan@××××××.com> |
18 |
date: Wed Jun 25 14:13:20 2008 -0700 |
19 |
summary: Check that git patches only touch files under root |
20 |
|
21 |
diff -r 55c71226eceb -r 87c704ac92d4 mercurial/patch.py |
22 |
--- a/mercurial/patch.py Thu Jun 26 18:44:54 2008 -0500 |
23 |
+++ b/mercurial/patch.py Wed Jun 25 14:13:20 2008 -0700 |
24 |
@@ -1039,9 +1039,12 @@ def applydiff(ui, fp, changed, strip=1, |
25 |
continue |
26 |
elif state == 'git': |
27 |
gitpatches = values |
28 |
+ cwd = os.getcwd() |
29 |
for gp in gitpatches: |
30 |
if gp.op in ('COPY', 'RENAME'): |
31 |
- copyfile(gp.oldpath, gp.path) |
32 |
+ src, dst = [util.canonpath(cwd, cwd, x) |
33 |
+ for x in [gp.oldpath, gp.path]] |
34 |
+ copyfile(src, dst) |
35 |
changed[gp.path] = (gp.op, gp) |
36 |
else: |
37 |
raise util.Abort(_('unsupported parser state: %s') % state) |
38 |
diff -r 55c71226eceb -r 87c704ac92d4 tests/test-import |
39 |
--- a/tests/test-import Thu Jun 26 18:44:54 2008 -0500 |
40 |
+++ b/tests/test-import Wed Jun 25 14:13:20 2008 -0700 |
41 |
@@ -261,3 +261,15 @@ hg status |
42 |
hg status |
43 |
cat a |
44 |
cd .. |
45 |
+ |
46 |
+echo % 'test paths outside repo root' |
47 |
+mkdir outside |
48 |
+touch outside/foo |
49 |
+hg init inside |
50 |
+cd inside |
51 |
+hg import - <<EOF |
52 |
+diff --git a/a b/b |
53 |
+rename from ../outside/foo |
54 |
+rename to bar |
55 |
+EOF |
56 |
+cd .. |
57 |
diff -r 55c71226eceb -r 87c704ac92d4 tests/test-import.out |
58 |
--- a/tests/test-import.out Thu Jun 26 18:44:54 2008 -0500 |
59 |
+++ b/tests/test-import.out Wed Jun 25 14:13:20 2008 -0700 |
60 |
@@ -260,3 +260,6 @@ adding a |
61 |
adding a |
62 |
applying patch from stdin |
63 |
bb |
64 |
+% test paths outside repo root |
65 |
+applying patch from stdin |
66 |
+abort: ../outside/foo not under root |
67 |
|
68 |
|
69 |
|
70 |
|
71 |
-- |
72 |
gentoo-commits@l.g.o mailing list |