Fix multi-project commit detection in GitLab import tool #135
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.
The GitLab commit import tool was only detecting commits from one project when users had multiple projects across different groups. This was caused by two bugs in the project processing logic:
Root Cause
Commit counter bug: The code incorrectly used the outer loop variable
projectID
(which always remained 0) instead of the actual project ID when storing commit counts:Pagination inefficiency: The
idAfter
parameter for cursor-based pagination was never updated, causing redundant GitLab API calls.Changes Made
projectCommitCounter[projectID]
toprojectCommitCounter[project]
to properly track each project's commitsidAfter
with the highest project ID from each page for efficient cursor-based paginationprojectID
variable toidAfter
to better reflect its purposeBefore vs After
Before (buggy behavior):
After (fixed behavior):
Impact
Users with multiple GitLab projects across different groups will now see commits imported from all their projects, not just one. The fix also improves GitLab API efficiency by implementing proper cursor-based pagination.
Fixes #82.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.