alibaba / git-repo-go

git-repo is a command-line tool for centralized workflow, can work with Gerrit, AGit-Flow compatible servers. It is written in Golang, and it can be installed easily without further dependency. It provides an easy-to-use solution for multiple repositories which is introduced by Android repo first, and it can also work with a single repository.
https://git-repo.info/
Apache License 2.0
262 stars 60 forks source link

Recursive manifest includes use the wrong base path #53

Open magnusbaeck opened 1 year ago

magnusbaeck commented 1 year ago

When the manifest contains recursive inclusions,

default.xml -> foo/bar.xml -> foo/base.xml

the original Repo code uses the directory of the top-level file (default.xml) when resolving the path of the included file, i.e. the inclusion filenames would be according to the example above. This is pretty clear when reading the _ParseManifestXml source code and its include_root parameter.

The code in this module instead joins the directory of the current file with the name from the include element, i.e. in the example above it would incorrectly attempt to open foo/foo/base.xml. https://github.com/alibaba/git-repo-go/blob/8d46bab638d4c8ca2794ae5b91fa5312d12778ab/manifest/manifest.go#L619