
Given the recent discussions on
planet.debian.org I use the opportunity to describe how you can handle upstream history in a
git-dpm workflow.
One of the primary points of git-dpm is that you should be able to just check out the Debian branch, get the
.orig.tar file(s) (for example using pristine-tar, by
git-dpm prepare or by just downloading them) and then calling
dpkg-buildpackage.
Thus the contents of the Debian branch need to be clean from
dpkg-source's point of view, that is do not contain any files the
.orig.tar file(s) contains not nor any modified files.
The easy way
The easiest way to get there is by importing the upstream tarball(s) as a git commit, which one will usually do with
git-dpm import-new-upstream as that also does some of the bookkeeping.
This new git commit will have (by default) the previous upstream commit and any parent you give with
-p as parents. (i.e. with
-p it will be a merge commit) and its content will be the contents of the tarball (with multiple
orig files, it gets more complicated).
The idea is of course that you give the upstream tag/commit belonging to this release tarball with
-p so that it becomes part of your history and so git blame can find those commits.
Thus you get a commit with the exact orig contents (so pristine-tar can more easily create small deltas) and the history combined..
Sometimes there are files in the upstream tarball that you do not want to have in your Debian branch (as you remove them in
debian/rules clean), then when using this method you will have those files in the upstream branch but you delete them in the Debian branch. (This is why
git-dpm merge-patched (the operation to merge a new branch with upstream + patches with your previous
debian/ directory) will look which files relative to the previous upstream branch are deleted and delete them also in the newly merged branch by default).
The complicated way
There is only a way without importing the
.orig.tar file(s), though that is a bit more complicated: The idea is that if your upstream's git repository contains all the files needed for building your Debian package (for example if you call
autoreconf in your Debian package and clean all the generated files in the clean target, or if upstream has a less sophisticated release process and their .tar contains only stuff from the git repository), you can just use the upstream git commit as base for your Debian branch.
Thus you can make upstream's commit/tag your upstream branch, by recording it with
git-dpm new-upstream together with the
.orig.tar it belongs to (Be careful, git-dpm does not check if that branch contains any files different than your
.orig.tar and could not decide if it misses any files you need to build even if it tried to tell).
Once that is merged with the
debian/ directory to create the Debian branch, you run
dpkg-buildpackage, which will call
dpkg-source which compares your working directory with the contents of the
.orig.tar with the patches applied. As it will only see files not there but no files modified or added (if everything was done correctly), one can work directly in the git checkout without needing to import the
.orig.tar files at all (altough the pristine-tar deltas might get a bit bigger).