My patches to convert the 3.0 (git) source format to use git bundles have landed in dpkg's git repository and will be in dpkg 1.15.8.

I think this second attempt at 3.0 (git) has worked out much better than the first. (Though the first was a pretty good success overall, since it also led all the other 3.0 formats eventually. ;) Perhaps the intervening years of git experience helped. The code is much simpler, with none of the ad-hoc hacks from the first version. The resulting git bundles can be manually cloned using git-bundle(1) where dpkg-source is not available.

There are two handy new features that can be controlled by debian/source/options. git-ref can be used to limit the branches/tags/etc that are included in the source package. And git-depth can cause a shallow clone of specified depth to be created and bundled.

dpkg-source: info: using options from debhelper/debian/source/options: --git-ref=gitsrc --git-ref=master --git-depth=10
dpkg-source: info: using source format `3.0 (git)'
dpkg-source: info: creating shallow clone with depth 10
dpkg-source: info: bundling: gitsrc master

A demo source package is here.

joey@gnu:~/tmp/t>dget http://kitenet.net/~joey/tmp/debhelper_7.9.4.dsc
...
dpkg-source: info: extracting debhelper in debhelper-7.9.4
dpkg-source: info: cloning debhelper_7.9.4.git
dpkg-source: info: setting up shallow clone
joey@gnu:~/tmp/t>ls -l
total 392
drwxr-xr-x 10 joey joey   4096 Jul 25 13:58 debhelper-7.9.4/
-rw-r--r--  1 joey joey   1779 Jul 25 13:58 debhelper_7.9.4.dsc
-rw-r--r--  1 joey joey 388859 Jul 25 13:58 debhelper_7.9.4.git
-rw-r--r--  1 joey joey    738 Jul 25 13:58 debhelper_7.9.4.gitshallow
joey@gnu:~/tmp/t>cd debhelper-7.9.4 
joey@gnu:~/tmp/t/debhelper-7.9.4>git branch -a
* gitsrc
  remotes/origin/HEAD -> origin/gitsrc
  remotes/origin/gitsrc
  remotes/origin/master

Notice that the branch I was in when I built the package is preserved, and the 19 revisions included in the shallow clone (10 per branch) take up very little space of course. This particular git source package turned out 30k larger than the tar.gz.

I am considering adding two other features:

  • Using VCS-Git fields to automatically set up origin when a git source package is unpacked.
  • Temporarily auto-committing uncommitted changes when building (currently the build fails when there are uncommitted changes).

I hope the next step will be for git source packages to be accepted in the Debian archive.