@@ -135,7 +135,7 @@ author KN4CK3R <admin@oldschoolhack.me> 1711702962 +0100
135
135
committer KN4CK3R <admin@oldschoolhack.me> 1711702962 +0100
136
136
encoding ISO-8859-1
137
137
gpgsig -----BEGIN PGP SIGNATURE-----
138
-
138
+ <SPACE>
139
139
iQGzBAABCgAdFiEE9HRrbqvYxPT8PXbefPSEkrowAa8FAmYGg7IACgkQfPSEkrow
140
140
Aa9olwv+P0HhtCM6CRvlUmPaqswRsDPNR4i66xyXGiSxdI9V5oJL7HLiQIM7KrFR
141
141
gizKa2COiGtugv8fE+TKqXKaJx6uJUJEjaBd8E9Af9PrAzjWj+A84lU6/PgPS8hq
@@ -150,7 +150,7 @@ gpgsig -----BEGIN PGP SIGNATURE-----
150
150
-----END PGP SIGNATURE-----
151
151
152
152
ISO-8859-1`
153
-
153
+ commitString = strings . ReplaceAll ( commitString , "<SPACE>" , " " )
154
154
sha := & Sha1Hash {0xfe , 0xaf , 0x4b , 0xa6 , 0xbc , 0x63 , 0x5f , 0xec , 0x44 , 0x2f , 0x46 , 0xdd , 0xd4 , 0x51 , 0x24 , 0x16 , 0xec , 0x43 , 0xc2 , 0xc2 }
155
155
gitRepo , err := openRepositoryWithDefaultContext (filepath .Join (testReposDir , "repo1_bare" ))
156
156
assert .NoError (t , err )
@@ -362,3 +362,41 @@ func Test_GetCommitBranchStart(t *testing.T) {
362
362
assert .NotEmpty (t , startCommitID )
363
363
assert .EqualValues (t , "9c9aef8dd84e02bc7ec12641deb4c930a7c30185" , startCommitID )
364
364
}
365
+
366
+ func TestConfigSubModule (t * testing.T ) {
367
+ input := `
368
+ [core]
369
+ path = test
370
+
371
+ [submodule "submodule1"]
372
+ path = path1
373
+ url = https://gitea.io/foo/foo
374
+ #branch = b1
375
+
376
+ [other1]
377
+ branch = master
378
+
379
+ [submodule "submodule2"]
380
+ path = path2
381
+ url = https://gitea.io/bar/bar
382
+ branch = b2
383
+
384
+ [other2]
385
+ branch = main
386
+
387
+ [submodule "submodule3"]
388
+ path = path3
389
+ url = https://gitea.io/xxx/xxx
390
+ `
391
+
392
+ subModules , err := configParseSubModules (strings .NewReader (input ))
393
+ assert .NoError (t , err )
394
+ assert .Len (t , subModules .cache , 3 )
395
+
396
+ sm1 , _ := subModules .Get ("path1" )
397
+ assert .Equal (t , & SubModule {Name : "path1" , URL : "https://gitea.io/foo/foo" }, sm1 )
398
+ sm2 , _ := subModules .Get ("path2" )
399
+ assert .Equal (t , & SubModule {Name : "path2" , URL : "https://gitea.io/bar/bar" }, sm2 )
400
+ sm3 , _ := subModules .Get ("path3" )
401
+ assert .Equal (t , & SubModule {Name : "path3" , URL : "https://gitea.io/xxx/xxx" }, sm3 )
402
+ }
0 commit comments