mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-10-04 20:47:07 +00:00
`LocalSyncState` uses `Project.relpath` to identify projects, but that path is relative to each project's own manifest. Projects in different manifests can have the same relpath, so their fetch and checkout timestamps overwrite each other. This can make a later partial sync look like a full sync. Pruning has a related problem. It treats the stored paths as relative to the current manifest's topdir, so when sync starts from the outermost manifest it can look for submanifest projects in the wrong place and remove valid state. Use `Project.RelPath(local=False)` to identify projects in local sync state and check stored paths from the repo root when pruning. Add tests for same-relpath projects, partial-sync detection, and pruning when sync starts from either the outermost manifest or a submanifest. Change-Id: I24485c315f1277a14913443674245cedd20820fe Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/632421 Reviewed-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Victor Pushkarev <corvinus.v@gmail.com> Commit-Queue: Victor Pushkarev <corvinus.v@gmail.com>
Repo Tests
There is a mixture of pytest & Python unittest in here. We adopted pytest later on but didn't migrate existing tests (since they still work). New tests should be written using pytest only.
File layout
test_xxx.py: Unittests for thexxxmodule in the main repo codebase. Modules that are in subdirs normalize the/into_. For example, test_error.py is for the error.py module, and test_subcmds_forall.py is for the subcmds/forall.py module.- conftest.py: Custom pytest fixtures for sharing.
- utils_for_test.py: Helpers for sharing in tests.