When there are nested Git repositories and the "repo sync" command is executed, there is a chance of encountering the error "error.GitError: Cannot checkout ..."

102 views
Skip to first unread message

jianwei deng

unread,
Apr 7, 2024, 12:46:00 PM4/7/24
to Repo and Gerrit Discussion
Hi all,
Problem description: When there are nested Git repositories and the "repo sync" command is executed, there is a chance of encountering the error "error.GitError: Cannot checkout ..."
Command used:
repo sync -cd --no-tags --prune --force-sync
Tools used:
git version 2.17.0
repo version v2.16.5-12-g7a616ce
Error log:
Garbage collecting: 100% (25/25), done in 0.075s
22:31:33 warning: unable to unlink 'SPSS.A1.1.9': Is a directory
22:31:33 fatal: cannot create directory at 'SPSS.A1.1.9': Is a directory
22:31:33 Checking out files: 58% (502/851)
......
22:32:17 error.GitError: Cannot checkout vendor/qcom/non-hlos: Cannot initialize work tree for vendor/qcom/non-hlos
22:32:17 error: Cannot checkout vendor/qcom/non-hlos
Problem analysis:
Git Repository-1:
name: vendor/qcom/non-hlos.git
path: vendor/qcom/non-hlos
This path contains a subdirectory: vendor/qcom/non-hlos/SPSS.A1.1.9
Git Repository-2:
name: vendor/qcom/non-hlos/SPSS.A1.1.9.git
path: vendor/qcom/non-hlos/SPSS.A1.1.9
During the execution of the "repo sync" command, both Git Repository-1 and Git Repository-2 will create the SPSS.A1.1.9 directory. In a multi-threaded environment, this can lead to conflicts.
1.Does Google's managed codebase allow for two different Git repositories to be nested within each other, where one repository is the root of the other?
2.Does repo allow for two different Git repositories to be nested within each other?
3.If repo allows for this situation and an error occurs, how should it be handled?

Thank you.
Reply all
Reply to author
Forward
0 new messages