go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.24k stars 5.5k forks source link

Fix submodule parsing (#32571) #32577

Closed wxiaoguang closed 1 day ago

wxiaoguang commented 1 day ago

A quick fix for #32568 Partially backport from #32571

silverwind commented 1 day ago

Would a ini parser work for parsing .gitmodules?

Also, imho this needs unit tests. Extract parsing logic into a function and test it?

lunny commented 1 day ago

Would a ini parser work for parsing .gitmodules?

Also, imho this needs unit tests. Extract parsing logic into a function and test it?

This is partially backport from #32571

silverwind commented 1 day ago

I see. I would have ported the whole configParseSubModules function, unless it has more dependencies.

wxiaoguang commented 1 day ago

Would a ini parser work for parsing .gitmodules?

No

Also, imho this needs unit tests. Extract parsing logic into a function and test it? ... I see. I would have ported the whole configParseSubModules function, unless it has more dependencies.

The logic is same as #32571 , but it is not easy to test it in a backport, otherwise it would introduce too many unnecessary changes. I have manually tested it in my 1.22 branch.

wxiaoguang commented 1 day ago

Added tests in adb668a82d4b51f785a807b098a6dbefc3ee4396