Thread (31 messages) flat view 31 messages, 2 authors, 2020-06-22
STALE2266d

Revision v2 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 11/14] git-svn: set the OID length based on hash algorithm

From: brian m. carlson <hidden>
Date: 2020-06-22 18:04:39
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 git-svn.perl | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/git-svn.perl b/git-svn.perl
index 00276c051b..58f5a7ac8f 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+)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help