Can't unset default branch for a git repository
Bug #1775148 reported by
Alberto Donato
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Critical
|
Ioana Lasc |
Bug Description
When editing details for a git repository, trying to unset the default branch (which is marked as optional) results in an OOPS.
I tried with https:/
Related branches
~ilasc/launchpad:bug-1775148
Merged
into
launchpad:master
- Colin Watson (community): Approve
-
Diff: 124 lines (+66/-0)4 files modifiedlib/lp/code/browser/gitrepository.py (+2/-0)
lib/lp/code/browser/tests/test_gitrepository.py (+17/-0)
lib/lp/code/model/gitrepository.py (+2/-0)
lib/lp/code/model/tests/test_gitrepository.py (+45/-0)
tags: | added: git lp-code oops |
Changed in launchpad: | |
status: | New → Triaged |
importance: | Undecided → Critical |
Changed in launchpad: | |
status: | Triaged → In Progress |
Changed in launchpad: | |
status: | In Progress → Fix Committed |
Changed in launchpad: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I initially thought that this would be a simple matter of not crashing when you unset the default branch, but on closer inspection I see that it isn't actually possible to unset the default branch in a git repository: the obvious git operations refuse when you try, and if you hack it directly out of the repository then you get something that doesn't count as a repository any more. So this code path needs to raise a proper exception rather than crashing, but we also need to mark the default branch as required on the webservice API.
(A slight wrinkle here is that default_branch may still be None for a brand-new repository that we haven't scanned yet; so if we mark that field as required then we need to make sure that a webservice GET on the repository still works.)