@noldova/checkpoints.git.linux-arm64 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +11 -2
- package/git/bin/git +0 -0
- package/git/bin/scalar +0 -0
- package/git/etc/gitconfig +13 -0
- package/git/libexec/git-core/git +0 -0
- package/git/libexec/git-core/git-archimport +1136 -0
- package/git/libexec/git-core/git-cvsexportcommit +469 -0
- package/git/libexec/git-core/git-cvsimport +1185 -0
- package/git/libexec/git-core/git-cvsserver +5109 -0
- package/git/libexec/git-core/git-daemon +0 -0
- package/git/libexec/git-core/git-difftool--helper +125 -0
- package/git/libexec/git-core/git-filter-branch +665 -0
- package/git/libexec/git-core/git-http-backend +0 -0
- package/git/libexec/git-core/git-http-fetch +0 -0
- package/git/libexec/git-core/git-imap-send +0 -0
- package/git/libexec/git-core/git-instaweb +786 -0
- package/git/libexec/git-core/git-merge-octopus +112 -0
- package/git/libexec/git-core/git-merge-one-file +167 -0
- package/git/libexec/git-core/git-merge-resolve +64 -0
- package/git/libexec/git-core/git-mergetool +579 -0
- package/git/libexec/git-core/git-mergetool--lib +549 -0
- package/git/libexec/git-core/git-quiltimport +155 -0
- package/git/libexec/git-core/git-receive-pack +0 -0
- package/git/libexec/git-core/git-remote-ftp +0 -0
- package/git/libexec/git-core/git-remote-ftps +0 -0
- package/git/libexec/git-core/git-remote-http +0 -0
- package/git/libexec/git-core/git-remote-https +0 -0
- package/git/libexec/git-core/git-request-pull +178 -0
- package/git/libexec/git-core/git-send-email +2474 -0
- package/git/libexec/git-core/git-sh-i18n +79 -0
- package/git/libexec/git-core/git-sh-i18n--envsubst +0 -0
- package/git/libexec/git-core/git-sh-setup +357 -0
- package/git/libexec/git-core/git-shell +0 -0
- package/git/libexec/git-core/git-submodule +671 -0
- package/git/libexec/git-core/git-upload-archive +0 -0
- package/git/libexec/git-core/git-upload-pack +0 -0
- package/git/libexec/git-core/git-web--browse +196 -0
- package/git/libexec/git-core/mergetools/araxis +26 -0
- package/git/libexec/git-core/mergetools/bc +37 -0
- package/git/libexec/git-core/mergetools/codecompare +31 -0
- package/git/libexec/git-core/mergetools/deltawalker +33 -0
- package/git/libexec/git-core/mergetools/diffmerge +26 -0
- package/git/libexec/git-core/mergetools/diffuse +23 -0
- package/git/libexec/git-core/mergetools/ecmerge +22 -0
- package/git/libexec/git-core/mergetools/emerge +34 -0
- package/git/libexec/git-core/mergetools/examdiff +24 -0
- package/git/libexec/git-core/mergetools/guiffy +26 -0
- package/git/libexec/git-core/mergetools/gvimdiff +1 -0
- package/git/libexec/git-core/mergetools/kdiff3 +44 -0
- package/git/libexec/git-core/mergetools/kompare +19 -0
- package/git/libexec/git-core/mergetools/meld +97 -0
- package/git/libexec/git-core/mergetools/nvimdiff +1 -0
- package/git/libexec/git-core/mergetools/opendiff +22 -0
- package/git/libexec/git-core/mergetools/p4merge +44 -0
- package/git/libexec/git-core/mergetools/smerge +20 -0
- package/git/libexec/git-core/mergetools/tkdiff +24 -0
- package/git/libexec/git-core/mergetools/tortoisemerge +40 -0
- package/git/libexec/git-core/mergetools/vimdiff +657 -0
- package/git/libexec/git-core/mergetools/vscode +19 -0
- package/git/libexec/git-core/mergetools/winmerge +23 -0
- package/git/libexec/git-core/mergetools/xxdiff +38 -0
- package/git/libexec/git-core/scalar +0 -0
- package/git/share/bash-completion/completions/git +4115 -0
- package/git/share/git-core/templates/description +1 -0
- package/git/share/git-core/templates/hooks/applypatch-msg.sample +15 -0
- package/git/share/git-core/templates/hooks/commit-msg.sample +74 -0
- package/git/share/git-core/templates/hooks/fsmonitor-watchman.sample +168 -0
- package/git/share/git-core/templates/hooks/post-update.sample +8 -0
- package/git/share/git-core/templates/hooks/pre-applypatch.sample +14 -0
- package/git/share/git-core/templates/hooks/pre-commit.sample +49 -0
- package/git/share/git-core/templates/hooks/pre-merge-commit.sample +13 -0
- package/git/share/git-core/templates/hooks/pre-push.sample +53 -0
- package/git/share/git-core/templates/hooks/pre-rebase.sample +169 -0
- package/git/share/git-core/templates/hooks/pre-receive.sample +24 -0
- package/git/share/git-core/templates/hooks/prepare-commit-msg.sample +42 -0
- package/git/share/git-core/templates/hooks/push-to-checkout.sample +78 -0
- package/git/share/git-core/templates/hooks/sendemail-validate.sample +77 -0
- package/git/share/git-core/templates/hooks/update.sample +128 -0
- package/git/share/git-core/templates/info/exclude +6 -0
- package/git/share/gitweb/gitweb.cgi +8499 -0
- package/git/share/gitweb/static/git-favicon.png +0 -0
- package/git/share/gitweb/static/git-logo.png +0 -0
- package/git/share/gitweb/static/gitweb.css +756 -0
- package/git/share/gitweb/static/gitweb.js +1579 -0
- package/git/share/locale/af/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/bg/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/ca/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/de/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/el/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/es/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/fr/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/ga/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/id/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/is/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/it/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/ko/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/pl/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/pt_BR/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/pt_PT/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/ru/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/sv/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/tr/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/uk/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/vi/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/zh_CN/LC_MESSAGES/git.mo +0 -0
- package/git/share/locale/zh_TW/LC_MESSAGES/git.mo +0 -0
- package/git/share/perl5/FromCPAN/Error.pm +1040 -0
- package/git/share/perl5/FromCPAN/Mail/Address.pm +280 -0
- package/git/share/perl5/Git/I18N.pm +125 -0
- package/git/share/perl5/Git/IndexInfo.pm +35 -0
- package/git/share/perl5/Git/LoadCPAN/Error.pm +10 -0
- package/git/share/perl5/Git/LoadCPAN/Mail/Address.pm +10 -0
- package/git/share/perl5/Git/LoadCPAN.pm +104 -0
- package/git/share/perl5/Git/Packet.pm +173 -0
- package/git/share/perl5/Git/SVN/Editor.pm +605 -0
- package/git/share/perl5/Git/SVN/Fetcher.pm +622 -0
- package/git/share/perl5/Git/SVN/GlobSpec.pm +65 -0
- package/git/share/perl5/Git/SVN/Log.pm +400 -0
- package/git/share/perl5/Git/SVN/Memoize/YAML.pm +93 -0
- package/git/share/perl5/Git/SVN/Migration.pm +265 -0
- package/git/share/perl5/Git/SVN/Prompt.pm +184 -0
- package/git/share/perl5/Git/SVN/Ra.pm +708 -0
- package/git/share/perl5/Git/SVN/Utils.pm +232 -0
- package/git/share/perl5/Git/SVN.pm +2573 -0
- package/git/share/perl5/Git.pm +1780 -0
- package/licenses/git/COPYING +360 -0
- package/licenses/git/LGPL-2.1 +511 -0
- package/licenses/perl-modules-from-cpan/Artistic +131 -0
- package/licenses/perl-modules-from-cpan/Copying +250 -0
- package/package.json +167 -4
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
package Git::SVN::Migration;
|
|
2
|
+
# these version numbers do NOT correspond to actual version numbers
|
|
3
|
+
# of git or git-svn. They are just relative.
|
|
4
|
+
#
|
|
5
|
+
# v0 layout: .git/$id/info/url, refs/heads/$id-HEAD
|
|
6
|
+
#
|
|
7
|
+
# v1 layout: .git/$id/info/url, refs/remotes/$id
|
|
8
|
+
#
|
|
9
|
+
# v2 layout: .git/svn/$id/info/url, refs/remotes/$id
|
|
10
|
+
#
|
|
11
|
+
# v3 layout: .git/svn/$id, refs/remotes/$id
|
|
12
|
+
# - info/url may remain for backwards compatibility
|
|
13
|
+
# - this is what we migrate up to this layout automatically,
|
|
14
|
+
# - this will be used by git svn init on single branches
|
|
15
|
+
# v3.1 layout (auto migrated):
|
|
16
|
+
# - .rev_db => .rev_db.$UUID, .rev_db will remain as a symlink
|
|
17
|
+
# for backwards compatibility
|
|
18
|
+
#
|
|
19
|
+
# v4 layout: .git/svn/$repo_id/$id, refs/remotes/$repo_id/$id
|
|
20
|
+
# - this is only created for newly multi-init-ed
|
|
21
|
+
# repositories. Similar in spirit to the
|
|
22
|
+
# --use-separate-remotes option in git-clone (now default)
|
|
23
|
+
# - we do not automatically migrate to this (following
|
|
24
|
+
# the example set by core git)
|
|
25
|
+
#
|
|
26
|
+
# v5 layout: .rev_db.$UUID => .rev_map.$UUID
|
|
27
|
+
# - newer, more-efficient format that uses 24-bytes per record
|
|
28
|
+
# with no filler space.
|
|
29
|
+
# - use xxd -c24 < .rev_map.$UUID to view and debug
|
|
30
|
+
# - This is a one-way migration, repositories updated to the
|
|
31
|
+
# new format will not be able to use old git-svn without
|
|
32
|
+
# rebuilding the .rev_db. Rebuilding the rev_db is not
|
|
33
|
+
# possible if noMetadata or useSvmProps are set; but should
|
|
34
|
+
# be no problem for users that use the (sensible) defaults.
|
|
35
|
+
use strict;
|
|
36
|
+
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
|
|
37
|
+
use Carp qw/croak/;
|
|
38
|
+
use File::Path qw/mkpath/;
|
|
39
|
+
use File::Basename qw/dirname basename/;
|
|
40
|
+
|
|
41
|
+
our $_minimize;
|
|
42
|
+
use Git qw(
|
|
43
|
+
command
|
|
44
|
+
command_noisy
|
|
45
|
+
command_output_pipe
|
|
46
|
+
command_close_pipe
|
|
47
|
+
command_oneline
|
|
48
|
+
);
|
|
49
|
+
use Git::SVN;
|
|
50
|
+
|
|
51
|
+
sub migrate_from_v0 {
|
|
52
|
+
my $git_dir = $ENV{GIT_DIR};
|
|
53
|
+
return undef unless -d $git_dir;
|
|
54
|
+
my ($fh, $ctx) = command_output_pipe(qw/rev-parse --symbolic --all/);
|
|
55
|
+
my $migrated = 0;
|
|
56
|
+
while (<$fh>) {
|
|
57
|
+
chomp;
|
|
58
|
+
my ($id, $orig_ref) = ($_, $_);
|
|
59
|
+
next unless $id =~ s#^refs/heads/(.+)-HEAD$#$1#;
|
|
60
|
+
my $info_url = command_oneline(qw(rev-parse --git-path),
|
|
61
|
+
"$id/info/url");
|
|
62
|
+
next unless -f $info_url;
|
|
63
|
+
my $new_ref = "refs/remotes/$id";
|
|
64
|
+
if (::verify_ref("$new_ref^0")) {
|
|
65
|
+
print STDERR "W: $orig_ref is probably an old ",
|
|
66
|
+
"branch used by an ancient version of ",
|
|
67
|
+
"git-svn.\n",
|
|
68
|
+
"However, $new_ref also exists.\n",
|
|
69
|
+
"We will not be able ",
|
|
70
|
+
"to use this branch until this ",
|
|
71
|
+
"ambiguity is resolved.\n";
|
|
72
|
+
next;
|
|
73
|
+
}
|
|
74
|
+
print STDERR "Migrating from v0 layout...\n" if !$migrated;
|
|
75
|
+
print STDERR "Renaming ref: $orig_ref => $new_ref\n";
|
|
76
|
+
command_noisy('update-ref', $new_ref, $orig_ref);
|
|
77
|
+
command_noisy('update-ref', '-d', $orig_ref, $orig_ref);
|
|
78
|
+
$migrated++;
|
|
79
|
+
}
|
|
80
|
+
command_close_pipe($fh, $ctx);
|
|
81
|
+
print STDERR "Done migrating from v0 layout...\n" if $migrated;
|
|
82
|
+
$migrated;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
sub migrate_from_v1 {
|
|
86
|
+
my $git_dir = $ENV{GIT_DIR};
|
|
87
|
+
my $migrated = 0;
|
|
88
|
+
return $migrated unless -d $git_dir;
|
|
89
|
+
my $svn_dir = Git::SVN::svn_dir();
|
|
90
|
+
|
|
91
|
+
# just in case somebody used 'svn' as their $id at some point...
|
|
92
|
+
return $migrated if -d $svn_dir && ! -f "$svn_dir/info/url";
|
|
93
|
+
|
|
94
|
+
print STDERR "Migrating from a git-svn v1 layout...\n";
|
|
95
|
+
mkpath([$svn_dir]);
|
|
96
|
+
print STDERR "Data from a previous version of git-svn exists, but\n\t",
|
|
97
|
+
"$svn_dir\n\t(required for this version ",
|
|
98
|
+
"($::VERSION) of git-svn) does not exist.\n";
|
|
99
|
+
my ($fh, $ctx) = command_output_pipe(qw/rev-parse --symbolic --all/);
|
|
100
|
+
while (<$fh>) {
|
|
101
|
+
my $x = $_;
|
|
102
|
+
next unless $x =~ s#^refs/remotes/##;
|
|
103
|
+
chomp $x;
|
|
104
|
+
my $info_url = command_oneline(qw(rev-parse --git-path),
|
|
105
|
+
"$x/info/url");
|
|
106
|
+
next unless -f $info_url;
|
|
107
|
+
my $u = eval { ::file_to_s($info_url) };
|
|
108
|
+
next unless $u;
|
|
109
|
+
my $dn = dirname("$svn_dir/$x");
|
|
110
|
+
mkpath([$dn]) unless -d $dn;
|
|
111
|
+
if ($x eq 'svn') { # they used 'svn' as GIT_SVN_ID:
|
|
112
|
+
mkpath(["$svn_dir/svn"]);
|
|
113
|
+
print STDERR " - $git_dir/$x/info => ",
|
|
114
|
+
"$svn_dir/$x/info\n";
|
|
115
|
+
rename "$git_dir/$x/info", "$svn_dir/$x/info" or
|
|
116
|
+
croak "$!: $x";
|
|
117
|
+
# don't worry too much about these, they probably
|
|
118
|
+
# don't exist with repos this old (save for index,
|
|
119
|
+
# and we can easily regenerate that)
|
|
120
|
+
foreach my $f (qw/unhandled.log index .rev_db/) {
|
|
121
|
+
rename "$git_dir/$x/$f", "$svn_dir/$x/$f";
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
print STDERR " - $git_dir/$x => $svn_dir/$x\n";
|
|
125
|
+
rename "$git_dir/$x", "$svn_dir/$x" or croak "$!: $x";
|
|
126
|
+
}
|
|
127
|
+
$migrated++;
|
|
128
|
+
}
|
|
129
|
+
command_close_pipe($fh, $ctx);
|
|
130
|
+
print STDERR "Done migrating from a git-svn v1 layout\n";
|
|
131
|
+
$migrated;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
sub read_old_urls {
|
|
135
|
+
my ($l_map, $pfx, $path) = @_;
|
|
136
|
+
my @dir;
|
|
137
|
+
foreach (<$path/*>) {
|
|
138
|
+
if (-r "$_/info/url") {
|
|
139
|
+
$pfx .= '/' if $pfx && $pfx !~ m!/$!;
|
|
140
|
+
my $ref_id = $pfx . basename $_;
|
|
141
|
+
my $url = ::file_to_s("$_/info/url");
|
|
142
|
+
$l_map->{$ref_id} = $url;
|
|
143
|
+
} elsif (-d $_) {
|
|
144
|
+
push @dir, $_;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
my $svn_dir = Git::SVN::svn_dir();
|
|
148
|
+
foreach (@dir) {
|
|
149
|
+
my $x = $_;
|
|
150
|
+
$x =~ s!^\Q$svn_dir\E/!!o;
|
|
151
|
+
read_old_urls($l_map, $x, $_);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
sub migrate_from_v2 {
|
|
156
|
+
my @cfg = command(qw/config -l/);
|
|
157
|
+
return if grep /^svn-remote\..+\.url=/, @cfg;
|
|
158
|
+
my %l_map;
|
|
159
|
+
read_old_urls(\%l_map, '', Git::SVN::svn_dir());
|
|
160
|
+
my $migrated = 0;
|
|
161
|
+
|
|
162
|
+
require Git::SVN;
|
|
163
|
+
foreach my $ref_id (sort keys %l_map) {
|
|
164
|
+
eval { Git::SVN->init($l_map{$ref_id}, '', undef, $ref_id) };
|
|
165
|
+
if ($@) {
|
|
166
|
+
Git::SVN->init($l_map{$ref_id}, '', $ref_id, $ref_id);
|
|
167
|
+
}
|
|
168
|
+
$migrated++;
|
|
169
|
+
}
|
|
170
|
+
$migrated;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
sub minimize_connections {
|
|
174
|
+
require Git::SVN;
|
|
175
|
+
require Git::SVN::Ra;
|
|
176
|
+
|
|
177
|
+
my $r = Git::SVN::read_all_remotes();
|
|
178
|
+
my $new_urls = {};
|
|
179
|
+
my $root_repos = {};
|
|
180
|
+
foreach my $repo_id (keys %$r) {
|
|
181
|
+
my $url = $r->{$repo_id}->{url} or next;
|
|
182
|
+
my $fetch = $r->{$repo_id}->{fetch} or next;
|
|
183
|
+
my $ra = Git::SVN::Ra->new($url);
|
|
184
|
+
|
|
185
|
+
# skip existing cases where we already connect to the root
|
|
186
|
+
if (($ra->url eq $ra->{repos_root}) ||
|
|
187
|
+
($ra->{repos_root} eq $repo_id)) {
|
|
188
|
+
$root_repos->{$ra->url} = $repo_id;
|
|
189
|
+
next;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
my $root_ra = Git::SVN::Ra->new($ra->{repos_root});
|
|
193
|
+
my $root_path = $ra->url;
|
|
194
|
+
$root_path =~ s#^\Q$ra->{repos_root}\E(/|$)##;
|
|
195
|
+
foreach my $path (keys %$fetch) {
|
|
196
|
+
my $ref_id = $fetch->{$path};
|
|
197
|
+
my $gs = Git::SVN->new($ref_id, $repo_id, $path);
|
|
198
|
+
|
|
199
|
+
# make sure we can read when connecting to
|
|
200
|
+
# a higher level of a repository
|
|
201
|
+
my ($last_rev, undef) = $gs->last_rev_commit;
|
|
202
|
+
if (!defined $last_rev) {
|
|
203
|
+
$last_rev = eval {
|
|
204
|
+
$root_ra->get_latest_revnum;
|
|
205
|
+
};
|
|
206
|
+
next if $@;
|
|
207
|
+
}
|
|
208
|
+
my $new = $root_path;
|
|
209
|
+
$new .= length $path ? "/$path" : '';
|
|
210
|
+
eval {
|
|
211
|
+
$root_ra->get_log([$new], $last_rev, $last_rev,
|
|
212
|
+
0, 0, 1, sub { });
|
|
213
|
+
};
|
|
214
|
+
next if $@;
|
|
215
|
+
$new_urls->{$ra->{repos_root}}->{$new} =
|
|
216
|
+
{ ref_id => $ref_id,
|
|
217
|
+
old_repo_id => $repo_id,
|
|
218
|
+
old_path => $path };
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
my @emptied;
|
|
223
|
+
foreach my $url (keys %$new_urls) {
|
|
224
|
+
# see if we can re-use an existing [svn-remote "repo_id"]
|
|
225
|
+
# instead of creating a(n ugly) new section:
|
|
226
|
+
my $repo_id = $root_repos->{$url} || $url;
|
|
227
|
+
|
|
228
|
+
my $fetch = $new_urls->{$url};
|
|
229
|
+
foreach my $path (keys %$fetch) {
|
|
230
|
+
my $x = $fetch->{$path};
|
|
231
|
+
Git::SVN->init($url, $path, $repo_id, $x->{ref_id});
|
|
232
|
+
my $pfx = "svn-remote.$x->{old_repo_id}";
|
|
233
|
+
|
|
234
|
+
my $old_fetch = quotemeta("$x->{old_path}:".
|
|
235
|
+
"$x->{ref_id}");
|
|
236
|
+
command_noisy(qw/config --unset/,
|
|
237
|
+
"$pfx.fetch", '^'. $old_fetch . '$');
|
|
238
|
+
delete $r->{$x->{old_repo_id}}->
|
|
239
|
+
{fetch}->{$x->{old_path}};
|
|
240
|
+
if (!keys %{$r->{$x->{old_repo_id}}->{fetch}}) {
|
|
241
|
+
command_noisy(qw/config --unset/,
|
|
242
|
+
"$pfx.url");
|
|
243
|
+
push @emptied, $x->{old_repo_id}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (@emptied) {
|
|
248
|
+
my $file = $ENV{GIT_CONFIG} ||
|
|
249
|
+
command_oneline(qw(rev-parse --git-path config));
|
|
250
|
+
print STDERR <<EOF;
|
|
251
|
+
The following [svn-remote] sections in your config file ($file) are empty
|
|
252
|
+
and can be safely removed:
|
|
253
|
+
EOF
|
|
254
|
+
print STDERR "[svn-remote \"$_\"]\n" foreach @emptied;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
sub migration_check {
|
|
259
|
+
migrate_from_v0();
|
|
260
|
+
migrate_from_v1();
|
|
261
|
+
migrate_from_v2();
|
|
262
|
+
minimize_connections() if $_minimize;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
1;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
package Git::SVN::Prompt;
|
|
2
|
+
use strict;
|
|
3
|
+
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
|
|
4
|
+
require SVN::Core;
|
|
5
|
+
use vars qw/$_no_auth_cache $_username/;
|
|
6
|
+
|
|
7
|
+
sub simple {
|
|
8
|
+
my ($cred, $realm, $default_username, $may_save, $pool) = @_;
|
|
9
|
+
$may_save = undef if $_no_auth_cache;
|
|
10
|
+
$default_username = $_username if defined $_username;
|
|
11
|
+
if (defined $default_username && length $default_username) {
|
|
12
|
+
if (defined $realm && length $realm) {
|
|
13
|
+
print STDERR "Authentication realm: $realm\n";
|
|
14
|
+
STDERR->flush;
|
|
15
|
+
}
|
|
16
|
+
$cred->username($default_username);
|
|
17
|
+
} else {
|
|
18
|
+
username($cred, $realm, $may_save, $pool);
|
|
19
|
+
}
|
|
20
|
+
$cred->password(_read_password("Password for '" .
|
|
21
|
+
$cred->username . "': ", $realm));
|
|
22
|
+
$cred->may_save($may_save);
|
|
23
|
+
$SVN::_Core::SVN_NO_ERROR;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
sub ssl_server_trust {
|
|
27
|
+
my ($cred, $realm, $failures, $cert_info, $may_save, $pool) = @_;
|
|
28
|
+
$may_save = undef if $_no_auth_cache;
|
|
29
|
+
print STDERR "Error validating server certificate for '$realm':\n";
|
|
30
|
+
{
|
|
31
|
+
no warnings 'once';
|
|
32
|
+
# All variables SVN::Auth::SSL::* are used only once,
|
|
33
|
+
# so we're shutting up Perl warnings about this.
|
|
34
|
+
if ($failures & $SVN::Auth::SSL::UNKNOWNCA) {
|
|
35
|
+
print STDERR " - The certificate is not issued ",
|
|
36
|
+
"by a trusted authority. Use the\n",
|
|
37
|
+
" fingerprint to validate ",
|
|
38
|
+
"the certificate manually!\n";
|
|
39
|
+
}
|
|
40
|
+
if ($failures & $SVN::Auth::SSL::CNMISMATCH) {
|
|
41
|
+
print STDERR " - The certificate hostname ",
|
|
42
|
+
"does not match.\n";
|
|
43
|
+
}
|
|
44
|
+
if ($failures & $SVN::Auth::SSL::NOTYETVALID) {
|
|
45
|
+
print STDERR " - The certificate is not yet valid.\n";
|
|
46
|
+
}
|
|
47
|
+
if ($failures & $SVN::Auth::SSL::EXPIRED) {
|
|
48
|
+
print STDERR " - The certificate has expired.\n";
|
|
49
|
+
}
|
|
50
|
+
if ($failures & $SVN::Auth::SSL::OTHER) {
|
|
51
|
+
print STDERR " - The certificate has ",
|
|
52
|
+
"an unknown error.\n";
|
|
53
|
+
}
|
|
54
|
+
} # no warnings 'once'
|
|
55
|
+
printf STDERR
|
|
56
|
+
"Certificate information:\n".
|
|
57
|
+
" - Hostname: %s\n".
|
|
58
|
+
" - Valid: from %s until %s\n".
|
|
59
|
+
" - Issuer: %s\n".
|
|
60
|
+
" - Fingerprint: %s\n",
|
|
61
|
+
map $cert_info->$_, qw(hostname valid_from valid_until
|
|
62
|
+
issuer_dname fingerprint);
|
|
63
|
+
my $choice;
|
|
64
|
+
prompt:
|
|
65
|
+
my $options = $may_save ?
|
|
66
|
+
"(R)eject, accept (t)emporarily or accept (p)ermanently? " :
|
|
67
|
+
"(R)eject or accept (t)emporarily? ";
|
|
68
|
+
STDERR->flush;
|
|
69
|
+
$choice = lc(substr(Git::prompt("Certificate problem.\n" . $options) || 'R', 0, 1));
|
|
70
|
+
if ($choice eq 't') {
|
|
71
|
+
$cred->may_save(undef);
|
|
72
|
+
} elsif ($choice eq 'r') {
|
|
73
|
+
return -1;
|
|
74
|
+
} elsif ($may_save && $choice eq 'p') {
|
|
75
|
+
$cred->may_save($may_save);
|
|
76
|
+
} else {
|
|
77
|
+
goto prompt;
|
|
78
|
+
}
|
|
79
|
+
$cred->accepted_failures($failures);
|
|
80
|
+
$SVN::_Core::SVN_NO_ERROR;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
sub ssl_client_cert {
|
|
84
|
+
my ($cred, $realm, $may_save, $pool) = @_;
|
|
85
|
+
$may_save = undef if $_no_auth_cache;
|
|
86
|
+
print STDERR "Client certificate filename: ";
|
|
87
|
+
STDERR->flush;
|
|
88
|
+
chomp(my $filename = <STDIN>);
|
|
89
|
+
$cred->cert_file($filename);
|
|
90
|
+
$cred->may_save($may_save);
|
|
91
|
+
$SVN::_Core::SVN_NO_ERROR;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
sub ssl_client_cert_pw {
|
|
95
|
+
my ($cred, $realm, $may_save, $pool) = @_;
|
|
96
|
+
$may_save = undef if $_no_auth_cache;
|
|
97
|
+
$cred->password(_read_password("Password: ", $realm));
|
|
98
|
+
$cred->may_save($may_save);
|
|
99
|
+
$SVN::_Core::SVN_NO_ERROR;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
sub username {
|
|
103
|
+
my ($cred, $realm, $may_save, $pool) = @_;
|
|
104
|
+
$may_save = undef if $_no_auth_cache;
|
|
105
|
+
if (defined $realm && length $realm) {
|
|
106
|
+
print STDERR "Authentication realm: $realm\n";
|
|
107
|
+
}
|
|
108
|
+
my $username;
|
|
109
|
+
if (defined $_username) {
|
|
110
|
+
$username = $_username;
|
|
111
|
+
} else {
|
|
112
|
+
$username = Git::prompt("Username: ");
|
|
113
|
+
}
|
|
114
|
+
$cred->username($username);
|
|
115
|
+
$cred->may_save($may_save);
|
|
116
|
+
$SVN::_Core::SVN_NO_ERROR;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
sub _read_password {
|
|
120
|
+
my ($prompt, $realm) = @_;
|
|
121
|
+
my $password = Git::prompt($prompt, 1);
|
|
122
|
+
$password;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
1;
|
|
126
|
+
__END__
|
|
127
|
+
|
|
128
|
+
=head1 NAME
|
|
129
|
+
|
|
130
|
+
Git::SVN::Prompt - authentication callbacks for git-svn
|
|
131
|
+
|
|
132
|
+
=head1 SYNOPSIS
|
|
133
|
+
|
|
134
|
+
use Git::SVN::Prompt qw(simple ssl_client_cert ssl_client_cert_pw
|
|
135
|
+
ssl_server_trust username);
|
|
136
|
+
use SVN::Client ();
|
|
137
|
+
|
|
138
|
+
my $cached_simple = SVN::Client::get_simple_provider();
|
|
139
|
+
my $git_simple = SVN::Client::get_simple_prompt_provider(\&simple, 2);
|
|
140
|
+
my $cached_ssl = SVN::Client::get_ssl_server_trust_file_provider();
|
|
141
|
+
my $git_ssl = SVN::Client::get_ssl_server_trust_prompt_provider(
|
|
142
|
+
\&ssl_server_trust);
|
|
143
|
+
my $cached_cert = SVN::Client::get_ssl_client_cert_file_provider();
|
|
144
|
+
my $git_cert = SVN::Client::get_ssl_client_cert_prompt_provider(
|
|
145
|
+
\&ssl_client_cert, 2);
|
|
146
|
+
my $cached_cert_pw = SVN::Client::get_ssl_client_cert_pw_file_provider();
|
|
147
|
+
my $git_cert_pw = SVN::Client::get_ssl_client_cert_pw_prompt_provider(
|
|
148
|
+
\&ssl_client_cert_pw, 2);
|
|
149
|
+
my $cached_username = SVN::Client::get_username_provider();
|
|
150
|
+
my $git_username = SVN::Client::get_username_prompt_provider(
|
|
151
|
+
\&username, 2);
|
|
152
|
+
|
|
153
|
+
my $ctx = new SVN::Client(
|
|
154
|
+
auth => [
|
|
155
|
+
$cached_simple, $git_simple,
|
|
156
|
+
$cached_ssl, $git_ssl,
|
|
157
|
+
$cached_cert, $git_cert,
|
|
158
|
+
$cached_cert_pw, $git_cert_pw,
|
|
159
|
+
$cached_username, $git_username
|
|
160
|
+
]);
|
|
161
|
+
|
|
162
|
+
=head1 DESCRIPTION
|
|
163
|
+
|
|
164
|
+
This module is an implementation detail of the "git svn" command.
|
|
165
|
+
It implements git-svn's authentication policy. Do not use it unless
|
|
166
|
+
you are developing git-svn.
|
|
167
|
+
|
|
168
|
+
The interface will change as git-svn evolves.
|
|
169
|
+
|
|
170
|
+
=head1 DEPENDENCIES
|
|
171
|
+
|
|
172
|
+
L<SVN::Core>.
|
|
173
|
+
|
|
174
|
+
=head1 SEE ALSO
|
|
175
|
+
|
|
176
|
+
L<SVN::Client>.
|
|
177
|
+
|
|
178
|
+
=head1 INCOMPATIBILITIES
|
|
179
|
+
|
|
180
|
+
None reported.
|
|
181
|
+
|
|
182
|
+
=head1 BUGS
|
|
183
|
+
|
|
184
|
+
None.
|