Importing a non-master git branch is unobvious

Bug #1000852 reported by Juhani Numminen
106
This bug affects 22 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

I would like to import branches other than HEAD from a git repository, but this seems not to be possible.

To reproduce:
1. Go to "Request code import" page for any project, e.g. for Launchpad: https://code.launchpad.net/launchpad/+new-import
2. In section Git, a label says: "The URL of the git repository. The HEAD branch will be imported."

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

You can specify a different branch to import by adding ",branch=NAME" to the end of the URL.

This should be documented, or we could possibly have a separate field in the UI.

Changed in launchpad:
status: New → Triaged
importance: Undecided → Low
summary: - git import can't import branches other than HEAD
+ document how to import non-HEAD git branches
Revision history for this message
Ivan Zakharyaschev (imz) wrote : Re: document how to import non-HEAD git branches

I had such a guess (write it after a comma, perhaps in the form of a key=VALUE pair) about how to import a branch other than HEAD, based on what I've read at http://doc.bazaar.canonical.com/developers/colocated-branches.html#ui-changes .

Ivan Zakharyaschev (imz)
summary: - document how to import non-HEAD git branches
+ can't import a non-HEAD git branch
Revision history for this message
Ivan Zakharyaschev (imz) wrote : Re: can't import a non-HEAD git branch

I've just tried to import a non-HEAD branch, but it doesn't work.

The example is https://code.launchpad.net/~imz/epiphany-browser/ps-memstat-data .

I've written in the Git repo URL field:

git://gitorious.org/ps-memstat/ps-memstat.git,branch=epiphany/ac100-second-longer

Here's the branch I want to import: https://gitorious.org/ps-memstat/ps-memstat/commits/epiphany/ac100-second-longer .

It has the commit with the message "Second longer run to collect stats for epiphany-browser-3.4.1-0ubuntu1 on Toshiba AC100.", but it hasn't been imported to https://code.launchpad.net/~imz/epiphany-browser/ps-memstat-data .

Ivan Zakharyaschev (imz)
Changed in launchpad:
status: Triaged → Confirmed
tags: added: branch bzr git
Curtis Hovey (sinzui)
Changed in launchpad:
status: Confirmed → Triaged
summary: - can't import a non-HEAD git branch
+ can't import a non-master git branch
Curtis Hovey (sinzui)
tags: added: feature
Revision history for this message
Gabriel Mazetto (brodock) wrote : Re: can't import a non-master git branch

It's 2014 now, any update on this ?

Revision history for this message
William Grant (wgrant) wrote :

As the comments above describe, one can import a non-HEAD git branch by appending ",branch=FOO" to the URL. There's no obvious UI for it, and that's what this bug covers now.

summary: - can't import a non-master git branch
+ Importing a non-master git branch is unobvious
Revision history for this message
Darik Horn (dajhorn) wrote :

This is a newly imported git repository on Launchpad that fails to import the desired branch for build recipes:

* https://code.launchpad.net/~zfs-native/+junk/pkg-spl-trusty

In this case, the importing URI is:

* git://github.com/zfsonlinux/pkg-spl.git,branch=master/ubuntu/trusty

But the README branch, which is the default branch at Github, is what Launchpad actually imports to BZR.

Revision history for this message
William Grant (wgrant) wrote :

The ,branch=FOO is an attribute of a particular path segment, so that URL requests the master branch. If you want to include a / in the branch name you need to URL-encode it (as %2F). I've fixed that import's URL.

Revision history for this message
Assem Chelli (عاصم شلي) (assem-ch) wrote :

I think you should update the note under the git url in "create a new branch":

"The URL of the git repository. The HEAD branch will be imported."

It's very confusing, I thought importing non-head branches is not implemented until I found the solution in this bug report.

Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

How does it work again?

If I try to import https://github.com/GNOME/geary.git,branch=geary-0.11, but it is only importing master branch.

Revision history for this message
William Grant (wgrant) wrote :

https://code.launchpad.net/~khurshid-alam/geary/geary-0.11 looks fine to me. What suggests it's master?

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

Other bug subscribers

Remote bug watches

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