Skip to content

Commit 66eadd1

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

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

git-svn.perl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ sub do_git_init_db {
500500
command_noisy('config', "$pfx.preserve-empty-dirs", 'true');
501501
command_noisy('config', "$pfx.placeholder-filename", $$fname);
502502
}
503+
load_object_format();
503504
}
504505

505506
sub init_subdir {
@@ -1977,9 +1978,15 @@ sub read_git_config {
19771978
}
19781979
}
19791980
}
1981+
load_object_format();
19801982
delete @$opts{@config_only} if @config_only;
19811983
}
19821984

1985+
sub load_object_format {
1986+
chomp(my $hash = `git config --get extensions.objectformat`);
1987+
$::oid_length = 64 if $hash eq 'sha256';
1988+
}
1989+
19831990
sub extract_metadata {
19841991
my $id = shift or return (undef, undef, undef);
19851992
my ($url, $rev, $uuid) = ($id =~ /^\s*git-svn-id:\s+(.*)\@(\d+)

0 commit comments

Comments
 (0)