git-cvsimport: port to SHA-256
Instead of calling the function is_sha1, call it is_oid and update it to match either a SHA-1 or a SHA-256 hex object ID. 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>
brian m. carlson committed
Jun 22, 2020 at 18:04 UTC
f3eaa09261c25813c84a0e47ce8a4dd1b9f5b717
1 file changed
+4
-4
git-cvsimport.perl
+4
-4
@@ -637,9 +637,9 @@ sub getwd() {
637
return $pwd;
638
}
639
640
-sub is_sha1 {
640
+sub is_oid {
641
my $s = shift;
642
- return $s =~ /^[a-f0-9]{40}$/;
642
+ return $s =~ /^[a-f0-9]{40}(?:[a-f0-9]{24})?$/;
643
}
644
645
sub get_headref ($) {
@@ -810,7 +810,7 @@ sub write_tree () {
810
open(my $fh, '-|', qw(git write-tree))
811
or die "unable to open git write-tree: $!";
812
chomp(my $tree = <$fh>);
813
- is_sha1($tree)
813
+ is_oid($tree)
814
or die "Cannot get tree id ($tree): $!";
815
close($fh)
816
or die "Error running git write-tree: $?\n";
@@ -896,7 +896,7 @@ sub commit {
896
897
print "Committed patch $patchset ($branch $commit_date)\n" if $opt_v;
898
chomp(my $cid = <$commit_read>);
899
- is_sha1($cid) or die "Cannot get commit id ($cid): $!\n";
899
+ is_oid($cid) or die "Cannot get commit id ($cid): $!\n";
900
print "Commit ID $cid\n" if $opt_v;
901
close($commit_read);
902