@matheusbsbs / matheus-bagliano / commits / 66eadd119a
Fork 0

git-svn: set the OID length based on hash algorithm

When reading the configuration or when creating a new repository, load the extensions.objectFormat value and set the object ID length to 64 if it's "sha256". Note that we use the hex length in git-svn because most of our processing is done on hex values, not binary ones. 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 66eadd119a02aa9a001d44006563b3bd99b41d54
1 file changed +7
git-svn.perl
+7
@@ -500,6 +500,7 @@ sub do_git_init_db {
500 command_noisy('config', "$pfx.preserve-empty-dirs", 'true');
501 command_noisy('config', "$pfx.placeholder-filename", $$fname);
502 }
503 + load_object_format();
504 }
505
506 sub init_subdir {
@@ -1977,9 +1978,15 @@ sub read_git_config {
1978 }
1979 }
1980 }
1981 + load_object_format();
1982 delete @$opts{@config_only} if @config_only;
1983 }
1984
1985 +sub load_object_format {
1986 + chomp(my $hash = `git config --get extensions.objectformat`);
1987 + $::oid_length = 64 if $hash eq 'sha256';
1988 +}
1989 +
1990 sub extract_metadata {
1991 my $id = shift or return (undef, undef, undef);
1992 my ($url, $rev, $uuid) = ($id =~ /^\s*git-svn-id:\s+(.*)\@(\d+)