git-debrebase can also be used in workflows without source packages,
for example to work on Debian-format packages outside or alongside Debian.
-git-debrebase is not very suitable for use by Debian derivatives,
+git-debrebase
+itself is not very suitable for use by Debian derivatives,
to work on packages inherited from Debian,
because it assumes that you want to throw away any packaging
provided by your upstream.
+However, of git-debrebase in Debian does not make anything harder for
+derivatives, and it can make some things easier.
+
+=head1 TERMINOLOGY
+
+=over
+
+=item Pseudomerge
+
+A merge which does not actually merge the trees;
+instead, it takes its tree, by construction, from only one parent.
+These are used to make a rewritten history fast forward
+from a previous tip,
+so that it can be pushed and pulled normally.
+Manual construction of pseudomerges can be done with
+C<git merge -s ours>
+but is not normally needed when using git-debrebase.
+
+=item Packaging files
+
+Files in the source tree within B<debian/>,
+excluding anything in B<debian/patches/>.
+
+=item Upstream
+
+The version of the package without Debian's packaging.
+Typically provided by the actual upstream project,
+and sometimes tracked by Debian contributors in a branch C<upstream>.
+
+Upstream contains upstream files,
+but some upstreams also contain packaging files in B<debian/>.
+Any such non-upstream files found in upstream
+are thrown away by git-debrebase
+each time a new upstream version is incorporated.
+
+=item Upstream files
+
+Files in the source tree outside B<debian/>.
+These may include unmodified source from upstream,
+but also files which have been modified or created for Debian.
+
+=item Delta queue
+
+Debian's changes to upstream files:
+a series of git commits.
+
+=item Quilt patches
+
+Files in B<debian/patches/> generated for the benefit of
+dpkg-source's 3.0 (quilt) .dsc source package format.
+Not used, often deleted, and regenerated when needed,
+by git-debrebase.
+
+=back
=head1 DIAGRAM
/ / / with debian/ directory
% % % entire delta queue applied
/ / / 3.0 (quilt) has debian/patches
- / / 3*
+ / / 3* "master" on Debian git servers
/ / /
2* 2* 2
/ / /
Rebase branch launderer turns each ! into an
equivalent *.
-=head1 BRANCHES AND BRANCH STATES
+=head1 BRANCHES AND BRANCH STATES - OVERVIEW
git-debrebase has one primary branch,
the B<interchange branch>.
but with Debian's packaging superimposed
(replacing any C<debian/> directory that may be in upstream).
The breakwater does not contain any representation of
-the delta queue.
+the delta queue (not even debian/patches).
The part of the breakwater processed by git-debrebase
is the part since the most reecent B<anchor>,
which is usually a special merge generated by git-debrebase.
the user's branch can be in a rebasing state,
known as B<unstitched>.
While a branch is unstitched,
-its previous tip is recorded,
+it is not in interchange format.
+The previous interchange branch tip
+tip is recorded,
so that the previous history
and the user's work
can later be
which means it has a more particular special form
convenient for manipulating the delta queue.
-=head1 BRANCH CONTENTS
+=head1 BRANCH CONTENTS - DETAILED SPECIFICATION
It is most convenient to describe the
-B<laundered>
-state first.
+B<breakwater>
+branch first.
+A breakwater is B<fast-forwarding>,
+but is not usually named by a ref.
It contains B<in this order> (ancestors first):
=over
containing only packaging changes.
(And no quilt patch changes.)
+=back
+
+The
+B<laundered>
+branch state is B<rebasing>.
+A laundered branch is based on a breakwater
+but also contains, additionally,
+B<after> the breakwater,
+a representation of the delta queue:
+
+=over
+
=item Delta queue commits
Zero or more single-parent commits
=back
-The
+The merely
B<unstitched>
-(unlaundered)
-branch state is the same,
+(ie, unstitched but unlaundered)
+branch state is also B<rebasing>.
+It has the same contents as the laundered state,
except that it may contain,
additionally,
-in B<in any order>:
+in B<in any order but after the breakwater>:
=over
Commit(s) which add patches to B<debian/patches/>,
and add those patches to the end of B<series>.
+
These are only necessary when working with
packages in C<.dsc 3.0 (quilt)> format.
For git-debrebase they are purely an output;
they are deleted when branches are laundered.
+git-debrebase takes care to make a proper patch
+series out of the delta queue,
+so that any resulting source packages are nice.
=back
-The
+Finally, an
B<interchange>
-branch state is the same, but may additionally contain
+branch is B<fast forwarding>.
+It has the same contents as an
+unlaundered branch state,
+but may (and usually will) additionally contain
(in some order,
possibly intermixed with the extra commits
which may be found on an unstitched unlaundered branch):
previous history.
The contributing parent is itself in interchange format.
Normally the overwritten parent is
-a previous tip of the interchange branch,
+a previous tip of an interchange branch,
but this is not necessary as the overwritten
parent is not examined.
the contributing parent is taken to be
the one with the later commit date,
or if the commit dates are the same,
-the left parent.
+the first parent.
=item dgit dsc import
=head1 STITCHING, PSEUDO-MERGES, FFQ RECORD
Whenever the branch C<refs/B> is unstitched,
-the previous tip is recorded in the git ref C<refs/ffq-prev/B>.
+the previous head is recorded in the git ref C<refs/ffq-prev/B>.
Unstiched branches are not fast forward from the published
interchange branches [1].
For this reason the tools will try to help the user
avoid divergence of the interchange branch.
+See dgit-maint-rebase(7) XXX TBD
+for a discussio of what kinds of behaviours
+should be be avoided
+because
+they might generate such merges.
+
Automatic resolution of divergent interchange branches
(or laundering of merges on the interchange branch)
is thought to be possible,
=item Launder branch
-Record the previous tip in ffq-prev,
+Record the previous head in ffq-prev,
if we were stitched before
(and delete debrebase-last).
followed by the delta queue,
turning C<-@-A-1-2-B3> into C<...@-A-B-1-2-3>.
-Drop pseudomerges and any quilt patches.
+Drop pseudomerges and any quilt patch additions.
=item Interactive rebase
=item New upstream rebase
Start rebasing onto a new upstream version,
-turning C<...#..@-A-B-1-2-3> into C<(...#..@-A-B-|...#'-)@'-1-2>.
+turning C<...#..@-A-B-1-2-3> into C<(...#..@-A-B-, ...#'-)@'-1-2>.
This has to be a wrapper around git-rebase,
which prepares @' and then tries to rebase 1 2 onto @'.
If the user asks for an interactive rebase,
-@' doesn't appear in the commit list.
+@' doesn't appear in the commit list, since
+@' is the newbase of the rebase (see git-rebase(1)).
Note that the construction of @' cannot fail
because @' simply copies debian/ from B and and everything else from #'.
tags are added to the pre-existing commit message,
when git-debrebase rewrites the commit.
-=head1 TERMINOLOGY
-
-=over
-
-=item Pseudomerge
-
-A merge which does not actually merge the trees;
-instead, it takes its tree, by construction, from only one parent.
-These are used to make a rewritten history fast forward
-from a previous tip,
-so that it can be pushed and pulled normally.
-Manual construction of pseudomerges can be done with
-C<git merge -s ours>
-but is not normally needed when using git-debrebase.
-
-=item Packaging files
-
-Files in the source tree within B<debian/>.
-(Does not include anything which may exist in B<debian/patches/>.)
-
-=item Upstream
-
-The version of the package without Debian's packaging.
-Typically provided by the actual upstream project,
-and often tracked by Debian contributors in a branch C<upstream>.
-
-=item Upstream files
-
-Files in the source tree outside B<debian/>.
-These may include unmodified source from upstream,
-but also files which have been modified or created for Debian.
-
-=item Delta queue
-
-Debian's changes to upstream files:
-a series of git commits.
-
-=item Quilt patches
-
-Files in B<debian/patches/> generated for the benefit of
-dpkg-source's 3.0 (quilt) .dsc source package format.
-Not used, and often deleted, by git-debrebase.
-
-=back
-
=head1 APPENDIX - DGIT IMPORT HANDLING
Consider a non-dgit NMU followed by a dgit NMU:
/ 3
/ 2
/ 1
- 2* &_
+ 2 &_
/ /| \
1 0 00 =XBC%
/
--#--------> upstream
- Key:
+ Supplementary key:
=XBC% dgit tarball import of .debian.tar.gz containing
Debian packaging including changes B C and quilt patches
/ 3 3
/ 2 2
/ 1 1
- 2* &_ /
+ 2 &_ /
/ /| \ /
1 0 00 =XBC% /
/ /
/ 3 3
/ 2 2
/ 1 1
- 2* &_ /
+ 2 &_ /
/ /| \ /
1 0 00 =XBC% /
/ /