Can't unset default branch for a git repository

Bug #1775148 reported by Alberto Donato
18
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://code.launchpad.net/~ack/maas/+git/maas/+edit and got OOPS-566201349957041290156dc6e4d9b9f9

Tags: git lp-code oops

Related branches

Colin Watson (cjwatson)
tags: added: git lp-code oops
Changed in launchpad:
status: New → Triaged
importance: Undecided → Critical
Revision history for this message
Colin Watson (cjwatson) wrote :

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.)

Changed in launchpad:
assignee: nobody → Ioana Lasc (ilasc)
Colin Watson (cjwatson)
Changed in launchpad:
status: Triaged → In Progress
Ioana Lasc (ilasc)
Changed in launchpad:
status: In Progress → Fix Committed
Tom Wardill (twom)
Changed in launchpad:
status: Fix Committed → Fix Released
Revision history for this message
Alberto Donato (ack) wrote :

Just a note that the form field still displays "(Optional)".
But the form correctly errors if no input is provided.

Revision history for this message
Alberto Donato (ack) wrote :

@cjwatson FTR https://code.launchpad.net/~ack/ubuntu/+source/maas/+git/maas has no branch.

The repo never had a master, and I can push and later delete branches without issues.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.