summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-06-22 18:04:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-06-22 18:21:07 (GMT)
commit66eadd119a02aa9a001d44006563b3bd99b41d54 (patch)
tree32a37f86a49f73329b0c030d1d25130d3f4b0592 /git-svn.perl
parent94b2ee1aeeb2dbec8383118db74d5c5c0a95476f (diff)
downloadgit-66eadd119a02aa9a001d44006563b3bd99b41d54.zip
git-66eadd119a02aa9a001d44006563b3bd99b41d54.tar.gz
git-66eadd119a02aa9a001d44006563b3bd99b41d54.tar.bz2
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>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl7
1 files changed, 7 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 00276c0..58f5a7a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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+)