]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-svn.perl
strmap: enable allocations to come from a mem_pool
[thirdparty/git.git] / git-svn.perl
index 7c735cebd38da934adcefed81539029863b21ea3..58f5a7ac8f80ac609fe1b35a558f936c7af42b98 100755 (executable)
@@ -500,6 +500,7 @@ sub do_git_init_db {
                command_noisy('config', "$pfx.preserve-empty-dirs", 'true');
                command_noisy('config', "$pfx.placeholder-filename", $$fname);
        }
+       load_object_format();
 }
 
 sub init_subdir {
@@ -1977,9 +1978,15 @@ sub read_git_config {
                        }
                }
        }
+       load_object_format();
        delete @$opts{@config_only} if @config_only;
 }
 
+sub load_object_format {
+       chomp(my $hash = `git config --get extensions.objectformat`);
+       $::oid_length = 64 if $hash eq 'sha256';
+}
+
 sub extract_metadata {
        my $id = shift or return (undef, undef, undef);
        my ($url, $rev, $uuid) = ($id =~ /^\s*git-svn-id:\s+(.*)\@(\d+)
@@ -2008,10 +2015,10 @@ sub cmt_sha2rev_batch {
                print $out $sha, "\n";
 
                while (my $line = <$in>) {
-                       if ($first && $line =~ /^[[:xdigit:]]{40}\smissing$/) {
+                       if ($first && $line =~ /^$::oid\smissing$/) {
                                last;
                        } elsif ($first &&
-                              $line =~ /^[[:xdigit:]]{40}\scommit\s(\d+)$/) {
+                              $line =~ /^$::oid\scommit\s(\d+)$/) {
                                $first = 0;
                                $size = $1;
                                next;