Fix persistent test failures related to git submodule operations #3
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.
Problem
This PR fixes the persistent test failures that were affecting 23 out of 55 tests in the submod repository. All failing tests were related to the same git submodule error:
Root Cause Analysis
The issue was caused by broken git submodule state where:
Solution
1. Fixed Git Repository Initialization (
tests/common/mod.rs)git checkout -b maingit symbolic-ref HEAD refs/heads/mainfor bare repositories--no-verifyflag to git push to bypass hooks in test environment2. Enhanced Submodule Cleanup (
src/gitoxide_manager.rs)git submodule deinit -fandgit rm -ffor proper cleanup--branch mainexplicitly in git submodule add commandsTest Results
Before Fix
Total: 2/55 tests passing
After Fix
Total: 51/55 tests passing 🎉
Impact
This fix resolves the core git submodule initialization and cleanup issues that were causing widespread test failures. The solution ensures that submodules are properly cleaned up before being added, preventing the "does not have a commit checked out" error.
The 4 remaining test failures are unrelated to the original submodule issue and involve:
These can be addressed in separate PRs as they are distinct issues from the git submodule problem that this PR solves.
💻 View my work • About Codegen