Skip to content

Conversation

@Tacha-S
Copy link
Contributor

@Tacha-S Tacha-S commented May 22, 2025

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

repositories:
  ripvcs:
    type: git
    url: https://github.com/Tacha-S/ripvcs.git
    version: test/nested_exclude
    exclude:
      - invalid_example.repos
      - valid_example.repos
      - valid_example.rosinstall

go run main.go import -i ./test/nested_example2.repos /tmp/example --recursive -x naoqi_libqicore

Copilot AI review requested due to automatic review settings May 22, 2025 01:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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{}

@ErickKramer
Copy link
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 ErickKramer self-requested a review May 22, 2025 07:27
@ErickKramer ErickKramer merged commit 071f3a7 into ErickKramer:main May 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import Order Causes Excluded Entries to Be Processed

2 participants