git-svn: error out when the SVN connection fails during a fetch
finish_report does seem to return a useful value indicating success or failure, so we'll just set a flag when close_edit is called (it is not called on failures, nor is abort_edit) and check the flag before proceeding. Thanks to Pazu for pointing this out. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
Nov 28, 2006 at 14:06 UTC
dad73c0bb9f33323ec1aacf560a6263f1d85f81a
1 file changed
+8
-1
git-svn.perl
+8
-1
@@ -2939,6 +2939,9 @@ sub libsvn_fetch_delta {
2939
$reporter->set_path('', $last_rev, 0, @lock, $pool);
2940
$reporter->finish_report($pool);
2941
$pool->clear;
2942
+ unless ($ed->{git_commit_ok}) {
2943
+ die "SVN connection failed somewhere...\n";
2944
+ }
2945
libsvn_log_entry($rev, $author, $date, $msg, [$last_commit]);
2946
}
2947
@@ -3193,6 +3196,9 @@ sub libsvn_new_tree {
3196
$reporter->set_path('', $rev, 1, @lock, $pool);
3197
$reporter->finish_report($pool);
3198
$pool->clear;
3199
+ unless ($ed->{git_commit_ok}) {
3200
+ die "SVN connection failed somewhere...\n";
3201
+ }
3202
} else {
3203
open my $gui, '| git-update-index -z --index-info' or croak $!;
3204
libsvn_traverse($gui, '', $SVN->{svn_path}, $rev);
@@ -3506,7 +3512,8 @@ sub abort_edit {
3512
3513
sub close_edit {
3514
my $self = shift;
3509
- close $self->{gui} or croak;
3515
+ close $self->{gui} or croak $!;
3516
+ $self->{git_commit_ok} = 1;
3517
$self->SUPER::close_edit(@_);
3518
}
3519