@matheusbsbs / matheus-bagliano / commits / d6d3346bab
Fork 0

git-svn: fix some issues for people migrating from older versions

* Fixed logic for renaming old .rev_db -> .rev_db.$uuid * correctly handle manual migrations for those who decide to start use globbing to handle branches/tags over individual 'fetch' keys Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Feb 16, 2007 at 04:05 UTC d6d3346babaf19864ea104b0140279e62f32f7e3
1 file changed +6 -4
git-svn.perl
+6 -4
@@ -844,6 +844,8 @@ sub fetch_all {
844 "svn-remote.$repo_id.${t}-maxRev") };
845 if (defined $max_rev && ($max_rev < $base)) {
846 $base = $max_rev;
847 + } elsif (!defined $max_rev) {
848 + $base = 0;
849 }
850 }
851
@@ -1066,10 +1068,7 @@ sub new {
1068 $self->{url} = command_oneline('config', '--get',
1069 "svn-remote.$repo_id.url") or
1070 die "Failed to read \"svn-remote.$repo_id.url\" in config\n";
1069 - if ((-z $self->db_path || ! -e $self->db_path) &&
1070 - ::verify_ref($self->refname.'^0')) {
1071 - $self->rebuild;
1072 - }
1071 + $self->rebuild;
1072 $self;
1073 }
1074
@@ -1737,6 +1736,8 @@ sub set_tree {
1736 sub rebuild {
1737 my ($self) = @_;
1738 my $db_path = $self->db_path;
1739 + return if (-e $db_path && ! -z $db_path);
1740 + return unless ::verify_ref($self->refname.'^0');
1741 if (-f $self->{db_root}) {
1742 rename $self->{db_root}, $db_path or die
1743 "rename $self->{db_root} => $db_path failed: $!\n";
@@ -1863,6 +1864,7 @@ sub rev_db_set {
1864
1865 sub rev_db_max {
1866 my ($self) = @_;
1867 + $self->rebuild;
1868 my $db_path = $self->db_path;
1869 my @stat = stat $db_path or return 0;
1870 ($stat[7] % 41) == 0 or die "$db_path inconsistent size: $stat[7]\n";