Skip to content

Commit

Permalink
git svn: avoid uninitialized var in 'reset'
Browse files Browse the repository at this point in the history
When "git svn reset" is called with an invalid revision, we
bail out and show the user a proper error message instead
of giving them a cryptic one related to git-svn internals.

ref: http://bugs.debian.org/578908
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reported-by: Jens Seidel <jensseidel@users.sf.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
  • Loading branch information
Jonathan Nieder authored and Eric Wong committed May 9, 2010
1 parent 212f0ba commit 70ee0b7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ sub cmd_reset {
"history\n";
}
my ($r, $c) = $gs->find_rev_before($target, not $_fetch_parent);
die "Cannot find SVN revision $target\n" unless defined($c);
$gs->rev_map_set($r, $c, 'reset', $uuid);
print "r$r = $c ($gs->{ref_id})\n";
}
Expand Down Expand Up @@ -3605,6 +3606,7 @@ sub mkfile {

sub rev_map_set {
my ($self, $rev, $commit, $update_ref, $uuid) = @_;
defined $commit or die "missing arg3\n";
length $commit == 40 or die "arg3 must be a full SHA1 hexsum\n";
my $db = $self->map_path($uuid);
my $db_lock = "$db.lock";
Expand Down

0 comments on commit 70ee0b7

Please sign in to comment.