From 412367bfafd9de014cfeb37475e0f97b1f6a2509 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Sat, 8 Nov 2025 00:06:16 +0100 Subject: project: Use dicts to keep track of copyfiles and linkfiles This avoids copying/linking the same file/link multiple times if a copyfile/linkfile element with the same values has been specifed multiple times. This can happen when including a common manifest that uses an extend-project element that has a copyfile/linkfile element. This uses dicts rather than sets to store the copyfiles and linkfiles to make sure the order they are specified in the manifest is maintained. For Python 3.7+, maintaining the order that keys are added to dicts is guaranteed, and for Python 3.6 it happened to be true. The _CopyFile class and the _LinkFile class are changed to inherit from NamedTuple to be able to store them in dicts. Change-Id: I9f5a80298b875251a81c5fe7d353e262d104fae4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/525322 Reviewed-by: Mike Frysinger Reviewed-by: Gavin Mak Tested-by: Peter Kjellerstedt Commit-Queue: Peter Kjellerstedt --- docs/manifest-format.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/manifest-format.md b/docs/manifest-format.md index d1a11cc99..42e1ab18a 100644 --- a/docs/manifest-format.md +++ b/docs/manifest-format.md @@ -453,10 +453,14 @@ Intermediate paths must not be symlinks either. Parent directories of "dest" will be automatically created if missing. +The files are copied in the order they are specified in the manifests. +If multiple elements specify the same source and destination, they will +only be applied as one, based on the first occurence. Files are copied +before any links specified via linkfile elements are created. + ### Element linkfile -It's just like copyfile and runs at the same time as copyfile but -instead of copying it creates a symlink. +It's just like copyfile, but instead of copying it creates a symlink. The symlink is created at "dest" (relative to the top of the tree) and points to the path specified by "src" which is a path in the project. @@ -466,6 +470,11 @@ Parent directories of "dest" will be automatically created if missing. The symlink target may be a file or directory, but it may not point outside of the repo client. +The links are created in the order they are specified in the manifests. +If multiple elements specify the same source and destination, they will +only be applied as one, based on the first occurence. Links are created +after any files specified via copyfile elements are copied. + ### Element remove-project Deletes a project from the internal manifest table, possibly -- cgit v1.2.3-54-g00ecf