Search code examples
repo

repo tool deletes obsolete paths in checkout


If your repository has a few paths that are synced by the repo tool using a manifest-file/group/branch & you run the repo commands (init->sync->checkout) again in the same repository but with some other manifest-file/group/branch having a different set of project paths then the current execution of the repo command will remove/delete the unnecessary project paths.

At least, what I expected from the repo tool was that the project paths which were not relevant to the current execution to be kept as is.

But, instead, you'll see a sequence of log lines saying the obsolete paths have been deleted as they were not necessary.

Deleting obsolete path /path/to/other/project1
Deleting obsolete path /path/to/other/project2
Deleting obsolete path /path/to/other/project3
Deleting obsolete path /path/to/other/project4

Repo tool has this by design.

I looked at multiple problems over the internet for solutions but couldn't find any.
Finally, I could design my own WAR.


Solution

  • Internally, the repo tool decides which paths to keep & which to delete in 2 ways.

    • If the paths to be deleted has some changes then it ignores deleting them.
    • By comparing the project.list file in the .repo folder & only keeps the ones listed in it.

    Method 1 wasn't much useful for me as before the checkout I happen to reset the entire working tree.
    On the other hand, Method 2 was what I needed.

    WAR
    Update the project.list file in .repo folder of the repository to remove the paths that you think the repo tool should not delete.
    Let's say I don't want repo tool to mess up my path "/path/to/other/project3" then I would remove this line from project.list file.