diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2020-06-22 18:04:14 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-06-22 11:21:07 -0700 |
commit | 94b2ee1aeeb2dbec8383118db74d5c5c0a95476f (patch) | |
tree | fb77cd9fd725cef67f1f81ceb11c069ff9a5ee25 /perl/Git/SVN/Editor.pm | |
parent | perl: make Git::IndexInfo work with SHA-256 (diff) | |
download | tgif-94b2ee1aeeb2dbec8383118db74d5c5c0a95476f.tar.xz |
perl: make SVN code hash independent
There are several places throughout git-svn that use various hard-coded
constants. For matching object IDs, use the $oid variable. Compute the
record size we use for our revision storage based on the object ID.
When parsing the revision map format, use a wildcard in the pack format
since we know that the data we're parsing is always exactly the record
size. This lets us continue to use a constant for the pack format.
Finally, update several comments to reflect the fact that an object ID
may be of one of multiple sizes.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl/Git/SVN/Editor.pm')
-rw-r--r-- | perl/Git/SVN/Editor.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/perl/Git/SVN/Editor.pm b/perl/Git/SVN/Editor.pm index 70b6d78cd9..c961444d4c 100644 --- a/perl/Git/SVN/Editor.pm +++ b/perl/Git/SVN/Editor.pm @@ -400,12 +400,12 @@ sub T { ($m->{mode_b} !~ /^120/ && $m->{mode_a} =~ /^120/)) { $self->D({ mode_a => $m->{mode_a}, mode_b => '000000', - sha1_a => $m->{sha1_a}, sha1_b => '0' x 40, + sha1_a => $m->{sha1_a}, sha1_b => '0' x $::oid_length, chg => 'D', file_b => $m->{file_b} }, $deletions); $self->A({ mode_a => '000000', mode_b => $m->{mode_b}, - sha1_a => '0' x 40, sha1_b => $m->{sha1_b}, + sha1_a => '0' x $::oid_length, sha1_b => $m->{sha1_b}, chg => 'A', file_b => $m->{file_b} }, $deletions); return; @@ -434,7 +434,7 @@ sub _chg_file_get_blob ($$$$) { $self->change_file_prop($fbat,'svn:special',undef); } my $blob = $m->{"sha1_$which"}; - return ($fh,) if ($blob =~ /^0{40}$/); + return ($fh,) if ($blob =~ /^0+$/); my $size = $::_repository->cat_blob($blob, $fh); croak "Failed to read object $blob" if ($size < 0); $fh->flush == 0 or croak $!; |