@@ -226,6 +226,7 @@ public void OpenRepository_Version1_Extensions()
226226 preciousObjects = true
227227 partialClone = promisor_remote
228228 worktreeConfig = true
229+ objectformat = sha256
229230" ) ;
230231
231232 Assert . True ( GitRepository . TryFindRepository ( gitDir . Path , out var location ) ) ;
@@ -264,6 +265,36 @@ public void OpenRepository_Version1_UnknownExtension()
264265 Assert . Throws < NotSupportedException > ( ( ) => GitRepository . OpenRepository ( src . Path , new GitEnvironment ( homeDir . Path ) ) ) ;
265266 }
266267
268+ [ Fact ]
269+ public void OpenRepository_Version1_ObjectFormatExtension ( )
270+ {
271+ using var temp = new TempRoot ( ) ;
272+
273+ var homeDir = temp . CreateDirectory ( ) ;
274+
275+ var workingDir = temp . CreateDirectory ( ) ;
276+ var gitDir = workingDir . CreateDirectory ( ".git" ) ;
277+
278+ gitDir . CreateFile ( "HEAD" ) . WriteAllText ( "ref: refs/heads/master" ) ;
279+ gitDir . CreateDirectory ( "refs" ) . CreateDirectory ( "heads" ) . CreateFile ( "master" ) . WriteAllText ( "0000000000000000000000000000000000000000" ) ;
280+ gitDir . CreateDirectory ( "objects" ) ;
281+
282+ gitDir . CreateFile ( "config" ) . WriteAllText ( @"
283+ [core]
284+ repositoryformatversion = 1
285+ [extensions]
286+ objectformat = sha256" ) ;
287+
288+ var src = workingDir . CreateDirectory ( "src" ) ;
289+
290+ // Should not throw - objectformat extension should be supported
291+ var repository = GitRepository . OpenRepository ( src . Path , new GitEnvironment ( homeDir . Path ) ) ;
292+ Assert . NotNull ( repository ) ;
293+ Assert . Equal ( gitDir . Path , repository . GitDirectory ) ;
294+ Assert . Equal ( gitDir . Path , repository . CommonDirectory ) ;
295+ Assert . Equal ( workingDir . Path , repository . WorkingDirectory ) ;
296+ }
297+
267298 [ Fact ]
268299 public void OpenRepository_VersionNotSupported ( )
269300 {
0 commit comments