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>
This commit is contained in:
parent
05ea93d6b2
commit
f3eaa09261
@ -637,9 +637,9 @@ sub getwd() {
|
|||||||
return $pwd;
|
return $pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub is_sha1 {
|
sub is_oid {
|
||||||
my $s = shift;
|
my $s = shift;
|
||||||
return $s =~ /^[a-f0-9]{40}$/;
|
return $s =~ /^[a-f0-9]{40}(?:[a-f0-9]{24})?$/;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_headref ($) {
|
sub get_headref ($) {
|
||||||
@ -810,7 +810,7 @@ sub write_tree () {
|
|||||||
open(my $fh, '-|', qw(git write-tree))
|
open(my $fh, '-|', qw(git write-tree))
|
||||||
or die "unable to open git write-tree: $!";
|
or die "unable to open git write-tree: $!";
|
||||||
chomp(my $tree = <$fh>);
|
chomp(my $tree = <$fh>);
|
||||||
is_sha1($tree)
|
is_oid($tree)
|
||||||
or die "Cannot get tree id ($tree): $!";
|
or die "Cannot get tree id ($tree): $!";
|
||||||
close($fh)
|
close($fh)
|
||||||
or die "Error running git write-tree: $?\n";
|
or die "Error running git write-tree: $?\n";
|
||||||
@ -896,7 +896,7 @@ sub commit {
|
|||||||
|
|
||||||
print "Committed patch $patchset ($branch $commit_date)\n" if $opt_v;
|
print "Committed patch $patchset ($branch $commit_date)\n" if $opt_v;
|
||||||
chomp(my $cid = <$commit_read>);
|
chomp(my $cid = <$commit_read>);
|
||||||
is_sha1($cid) or die "Cannot get commit id ($cid): $!\n";
|
is_oid($cid) or die "Cannot get commit id ($cid): $!\n";
|
||||||
print "Commit ID $cid\n" if $opt_v;
|
print "Commit ID $cid\n" if $opt_v;
|
||||||
close($commit_read);
|
close($commit_read);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user