Skip to content

Commit f3eaa09

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Acked-by: Eric Wong <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05ea93d commit f3eaa09

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git-cvsimport.perl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,9 @@ ()
637637
return $pwd;
638638
}
639639

640-
sub is_sha1 {
640+
sub is_oid {
641641
my $s = shift;
642-
return $s =~ /^[a-f0-9]{40}$/;
642+
return $s =~ /^[a-f0-9]{40}(?:[a-f0-9]{24})?$/;
643643
}
644644

645645
sub get_headref ($) {
@@ -810,7 +810,7 @@ ()
810810
open(my $fh, '-|', qw(git write-tree))
811811
or die "unable to open git write-tree: $!";
812812
chomp(my $tree = <$fh>);
813-
is_sha1($tree)
813+
is_oid($tree)
814814
or die "Cannot get tree id ($tree): $!";
815815
close($fh)
816816
or die "Error running git write-tree: $?\n";
@@ -896,7 +896,7 @@ sub commit {
896896

897897
print "Committed patch $patchset ($branch $commit_date)\n" if $opt_v;
898898
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";
900900
print "Commit ID $cid\n" if $opt_v;
901901
close($commit_read);
902902

0 commit comments

Comments
 (0)