Resolve exclude correctly#27
Merged
ErickKramer merged 3 commits intoErickKramer:mainfrom May 22, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR resolves repository exclusion issues by restricting the search to directories specified in the initial .repos file and improves branch switching behavior when updates are needed.
- Modified repository file discovery to filter based on previously cloned paths.
- Updated git clone logic to support branch switching when the version differs.
- Adjusted function signatures and tests to propagate the new clonedPaths parameter.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| utils/repos_helpers.go | Added clonedPaths filtering when walking the file system search. |
| utils/git_helpers.go | Revised GitClone to return SwitchedBranch when appropriate. |
| test/repos_helpers_test.go | Updated tests to supply nil for clonedPaths where needed. |
| test/git_helpers_test.go | Extended tests to verify branch switching behavior. |
| cmd/import.go | Propagated clonedPaths through functions and updated exclusions logic. |
Comments suppressed due to low confidence (2)
utils/git_helpers.go:217
- Consider renaming 'skip_clone' to 'skipClone' to follow Go naming conventions.
var skip_clone bool = false
cmd/import.go:45
- [nitpick] The variable name 'hardCodedExcludeList' could be made more descriptive, for example 'initialExcludeList', to improve clarity.
var hardCodedExcludeList = []string{}
Owner
|
Thanks for the contribution! I tested it and I did not find the import order issue anymore. Switching the branch if changed is quite a nice addition as well! |
ErickKramer
approved these changes
May 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I resolved an issue where, in an already constructed environment, repositories were cloned before being excluded due to the order in which they were discovered.
From now on, only the directories listed in the initially specified .repos file will be recursively searched.
In other words, even if there are other .repos files or manually cloned repositories in the workspace, those .repos files will no longer be part of the search targets.
I believe this behavior is correct for an “import based on the initially specified .repos file.”
Separately, there may be value in having a feature that imports all .repos files discovered across the entire workspace, without an initially specified .repos file.
However, I consider that to be a different issue.
Additionally, during testing, I noticed that attempting to change only the version of an already cloned repository resulted in “Skipped cloning,” and the version remained unchanged.
To address this, I made it so that even if the repository is already cloned, it will be switched if the version differs. f241ad4
test behavior
nested_example2.repos
go run main.go import -i ./test/nested_example2.repos /tmp/example --recursive -x naoqi_libqicore