[PATCH] git-svn: extra error check to ensure we open a file correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This may be an issue with repositories imported with commit
27a1a8014b842c0d70fdc91c68dd361ca2dfb34c or later, but before
commit dad73c0bb9f33323ec1aacf560a6263f1d85f81a.

Signed-off-by: Eric Wong <normalperson@xxxxxxxx>
---

Eric Wong <normalperson@xxxxxxxx> wrote:
> "Randal L. Schwartz" <merlyn@xxxxxxxxxxxxxx> wrote:
> > >>>>> "Eric" == Eric Wong <normalperson@xxxxxxxx> writes:
> > 
> > Eric> "Randal L. Schwartz" <merlyn@xxxxxxxxxxxxxx> wrote:
> > >> 
> > >> Does this ring a bell?
> > 
> > Eric> Nope.
> > 
> > Eric> This is on r15941 of  https://svn.perl.org/parrot/trunk ?  I can't seem
> > Eric> to reproduce this with git svn fetch -r15940:15941
> > 
> > No, and that worked for me as well.  Apparently, I might have corrupted my
> > metadata because I updated git-svn while I was using it.  Is there any way to
> > reset the metadata without having to re-fetch 15000 revisions?

I fear I may have been looking in the wrong place while trying to
diagnose merlyn's problem.  He did mention he was on a flaky connection
and that may have caused the corruption if he had one of those bad
versions.

 git-svn.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 747daf0..ff61b92 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3438,6 +3438,9 @@ sub open_file {
 	my ($self, $path, $pb, $rev) = @_;
 	my ($mode, $blob) = (safe_qx('git-ls-tree',$self->{c},'--',$path)
 	                     =~ /^(\d{6}) blob ([a-f\d]{40})\t/);
+	unless (defined $mode && defined $blob) {
+		die "$path was not found in commit $self->{c} (r$rev)\n";
+	}
 	{ path => $path, mode_a => $mode, mode_b => $mode, blob => $blob,
 	  pool => SVN::Pool->new, action => 'M' };
 }
-- 
1.4.4.1.g9c35e-dirty

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]