]> git.pld-linux.org Git - packages/git-core.git/blame - git-core-svn-serf.patch
apache multiversion config
[packages/git-core.git] / git-core-svn-serf.patch
CommitLineData
c64c444d
KK
1From 4e63dcc86cc77ec86a8d35ff752603a4b44d44a7 Mon Sep 17 00:00:00 2001
2From: "Kyle J. McKay" <mackyle@gmail.com>
3Date: Sat, 6 Jul 2013 21:20:48 -0700
4Subject: [PATCH 1/2] Git.pm: add new temp_is_locked function
5
6The temp_is_locked function can be used to determine whether
7or not a given name previously passed to temp_acquire is
8currently locked.
9
10Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
11Signed-off-by: Junio C Hamano <gitster@pobox.com>
12---
13 perl/Git.pm | 33 +++++++++++++++++++++++++++++++--
14 1 file changed, 31 insertions(+), 2 deletions(-)
15
16diff --git a/perl/Git.pm b/perl/Git.pm
17index 7a252ef..0ba15b9 100644
18--- a/perl/Git.pm
19+++ b/perl/Git.pm
20@@ -61,7 +61,7 @@ require Exporter;
21 remote_refs prompt
22 get_tz_offset
23 credential credential_read credential_write
24- temp_acquire temp_release temp_reset temp_path);
25+ temp_acquire temp_is_locked temp_release temp_reset temp_path);
26
27
28 =head1 DESCRIPTION
29@@ -1206,6 +1206,35 @@ sub temp_acquire {
30 $temp_fd;
31 }
32
33+=item temp_is_locked ( NAME )
34+
35+Returns true if the internal lock created by a previous C<temp_acquire()>
36+call with C<NAME> is still in effect.
37+
38+When temp_acquire is called on a C<NAME>, it internally locks the temporary
39+file mapped to C<NAME>. That lock will not be released until C<temp_release()>
40+is called with either the original C<NAME> or the L<File::Handle> that was
41+returned from the original call to temp_acquire.
42+
43+Subsequent attempts to call C<temp_acquire()> with the same C<NAME> will fail
44+unless there has been an intervening C<temp_release()> call for that C<NAME>
45+(or its corresponding L<File::Handle> that was returned by the original
46+C<temp_acquire()> call).
47+
48+If true is returned by C<temp_is_locked()> for a C<NAME>, an attempt to
49+C<temp_acquire()> the same C<NAME> will cause an error unless
50+C<temp_release> is first called on that C<NAME> (or its corresponding
51+L<File::Handle> that was returned by the original C<temp_acquire()> call).
52+
53+=cut
54+
55+sub temp_is_locked {
56+ my ($self, $name) = _maybe_self(@_);
57+ my $temp_fd = \$TEMP_FILEMAP{$name};
58+
59+ defined $$temp_fd && $$temp_fd->opened && $TEMP_FILES{$$temp_fd}{locked};
60+}
61+
62 =item temp_release ( NAME )
63
64 =item temp_release ( FILEHANDLE )
c64c444d
KK
65--
661.8.3.2
67
68
69From 8ac251b66b952b0eddfa4e5bbf08a3c0ae7dbc0b Mon Sep 17 00:00:00 2001
70From: "Kyle J. McKay" <mackyle@gmail.com>
71Date: Sat, 6 Jul 2013 21:20:49 -0700
72Subject: [PATCH 2/2] git-svn: allow git-svn fetching to work using serf
73
74When attempting to git-svn fetch files from an svn https?: url using
75the serf library (the only choice starting with svn 1.8) the following
76errors can occur:
77
78Temp file with moniker 'svn_delta' already in use at Git.pm line 1250
79Temp file with moniker 'git_blob' already in use at Git.pm line 1250
80
81David Rothenberger <daveroth@acm.org> has determined the cause to
82be that ra_serf does not drive the delta editor in a depth-first
83manner [...]. Instead, the calls come in this order:
84
851. open_root
862. open_directory
873. add_file
884. apply_textdelta
895. add_file
906. apply_textdelta
91
92When using the ra_serf access method, git-svn can end up needing
93to create several temp files before the first one is closed.
94
95This change causes a new temp file moniker to be generated if the
96one that would otherwise have been used is currently locked.
97
98Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
99Signed-off-by: Junio C Hamano <gitster@pobox.com>
100---
101 perl/Git/SVN/Fetcher.pm | 6 ++++--
102 1 file changed, 4 insertions(+), 2 deletions(-)
103
104diff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm
105index bd17418..10edb27 100644
106--- a/perl/Git/SVN/Fetcher.pm
107+++ b/perl/Git/SVN/Fetcher.pm
108@@ -315,11 +315,13 @@ sub change_file_prop {
109 sub apply_textdelta {
110 my ($self, $fb, $exp) = @_;
111 return undef if $self->is_path_ignored($fb->{path});
112- my $fh = $::_repository->temp_acquire('svn_delta');
113+ my $suffix = 0;
114+ ++$suffix while $::_repository->temp_is_locked("svn_delta_${$}_$suffix");
115+ my $fh = $::_repository->temp_acquire("svn_delta_${$}_$suffix");
116 # $fh gets auto-closed() by SVN::TxDelta::apply(),
117 # (but $base does not,) so dup() it for reading in close_file
118 open my $dup, '<&', $fh or croak $!;
119- my $base = $::_repository->temp_acquire('git_blob');
120+ my $base = $::_repository->temp_acquire("git_blob_${$}_$suffix");
121
122 if ($fb->{blob}) {
123 my ($base_is_link, $size);
124--
1251.8.3.2
126
This page took 0.072865 seconds and 4 git commands to generate.