Git Provider: do not pull after init. if pull fails, library is not ready.#753
Git Provider: do not pull after init. if pull fails, library is not ready.#753
Conversation
…gh the git is initialized. unrecoverable failure.
📝 WalkthroughWalkthroughThe pull request modifies Git repository initialization to defer pulling until the periodic pull task runs. The ChangesGit Provider Initialization Behavior
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@asab/library/providers/git.py`:
- Around line 373-375: The provider can open a cached repo
(pygit2.Repository(self.RepoPath)) but may lack an "origin" remote causing a
KeyError later in _do_fetch when accessing self.GitRepository.remotes["origin"];
before calling _set_ready() validate that self.GitRepository.remotes contains
"origin" (e.g., check "origin" in self.GitRepository.remotes) and raise/handle a
descriptive error if missing so init fails fast, and update the exception
handling in _periodic_pull() to also catch KeyError (in addition to
pygit2.GitError) so a missing/corrupt origin is handled gracefully during
periodic fetchs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 089aa087-bea3-4d76-b9cf-2ae3247ad9e5
📒 Files selected for processing (1)
asab/library/providers/git.py
I went through the git provider with several robots and this is the only bug I found and it is not in the code that would be used.
I failed to improve it more.
So this is it.
So, I am closing this MR: github.com//pull/751
It is redundant refactoring.
And I'll finish this: #751
as I didn't find any other line to change.
Let's see...
Summary by CodeRabbit