git-ubuntu rich history beta

Robie Basak robie.basak at
Wed Oct 13 16:52:10 UTC 2021

git-ubuntu is now able to accept rich history directly from any uploader.

The CLI is in beta and subject to change. Feedback appreciated!

# Summary

    sudo snap refresh --beta git-ubuntu  # beta channel snap required

    git ubuntu clone foo
    cd foo
    <make and commit your changes>
    dpkg-buildpackage <your normal options> $(git ubuntu prepare-upload args)
    <dput as usual>

Alternatively, if you don't use dpkg-buildpackage, you can prepare your
source upload as usual, use
`git ubuntu prepare-upload mangle <../changes file here>` to add the
extra headers, sign (or re-sign) the changes file with `debsign` and
then upload as usual.

# CLI Design

Ubuntu developers tend to have complex and custom workflows. To try and
support them all, I've started by implementing the low level first. I
didn't want to wrap everything and assume that you generate the changes
file in some particular way. The `prepare-upload` subcommand is intended
for integration and wrapping by your own tooling. I suggest you make an
alias or wrapper script to operate it in the way that you want.

Eventually I expect a high level CLI such as `git ubuntu submit` to do
all the work for you, but I want to get the low level stuff right first.

# Details of what the subcommands do

There are two subcommands being added here: `git ubuntu prepare-upload
args` and `git ubuntu prepare-upload mangle`. Both will push the current
branch to a personal remote (defaulting to your personal Launchpad
namespace that `git ubuntu clone` sets up named after your Launchpad
username; details overridable with `--remote` and `--branch`). After
that, `args` will output the required additional changes file headers in
a form suitable for `dpkg-buildpackage`. `mangle` will instead replace
an existing changes file to add the headers, stripping the signature if
it was signed (as the alteration requires re-signing).

# Details of the changes file headers

 * Vcs-Git: points to the git repository where the rich history can be

 * Vcs-Git-Ref: the ref which when fetched contains the rich history.

 * Vcs-Git-Commit: the commit hash of your rich history. This must match
   your upload.

When git-ubuntu imports your upload, it will look in the location
specified by these headers for the rich history. If present and if they
match your upload, then it will use your commit instead of synthesizing
its own.

# Caveats

 * If empty directories exist in your source, then your rich history
   will likely mismatch and will be rejected. A synthesized commit will
   be used instead. git-ubuntu will warn you if this is about to happen
   if you used `git-ubuntu clone`. See LP: #1917877 for details and a

 * Note that error paths are not currently well handled. I intend to fix
   these before a final release. I'd appreciate feedback on what edge
   cases you hit, so I can make sure I handle those.

 * For now, only Launchpad git URLs are accepted to avoid the risk from
   a malicious git repository host. `git-ubuntu prepare-upload` will
   check that the URL will be acceptable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the ubuntu-devel mailing list