bug: Error when syncing git repositories due to unbound branch variable #1389
Labels
group/backend
Issue related to the backend (API Server, Git Agent)
type/bug
Something isn't working as expected
Milestone
Component
Git Integration
Current Behavior
When syncing a repository the process can fail due to a branch variable being unbound.
The problem comes from a method that looks like this:
When running
self.create_branch_in_graph()
we catch a GraphQLError but then continue if the branch already exists we continue to the next line forself.create_branch_in_git()
in this case the branch variable is unbound and doesn't exist so the sync fails.Expected Behavior
No response
Steps to Reproduce
Bug found by @fooelisa, probably a branch that existed in the external repo already existed in Infrahub.
Additional Information
Some things to note is that Pylance warns for this in VS Code, we should check to see if Ruff has a rule to find things like this.
The text was updated successfully, but these errors were encountered: