Package: dgit
Version: 9.5
Tags: patch

Hello,

When Debianising a new package yesterday I discovered several issues
with the tarball workflows recommended in these two manpages.  Detailed
in the commit messages of the attached three patches.

-- 
Sean Whitton
From 37d7bb9cfd2349f41639a4788b095dc4f2d4b0f3 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhit...@spwhitton.name>
Date: Wed, 24 Jul 2019 20:05:34 +0100
Subject: [PATCH 1/3] d-m-{merge,debrebase}(7): Use an 'upstream/' tag prefix
 in gbp.conf

This is a useful convention to distinguish actual upstream tags from
upstream tarball-representing tags created by the Debian package
maintainer.

Note that use of this convention is already recommended in section
"Using untagged upstream commits".

Signed-off-by: Sean Whitton <spwhit...@spwhitton.name>
---
 dgit-maint-debrebase.7.pod | 4 +++-
 dgit-maint-merge.7.pod     | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dgit-maint-debrebase.7.pod b/dgit-maint-debrebase.7.pod
index 9c9598bb..2ac70b57 100644
--- a/dgit-maint-debrebase.7.pod
+++ b/dgit-maint-debrebase.7.pod
@@ -181,7 +181,7 @@ Now create I<debian/gbp.conf>:
     [DEFAULT]
     upstream-branch = upstream
     debian-branch = master
-    upstream-tag = %(version)s
+    upstream-tag = upstream/%(version)s
 
     sign-tags = True
     pristine-tar = False
@@ -392,6 +392,8 @@ or if you have a working watch file
 
 =back
 
+replacing I<1.2.3> with I<upstream/1.2.3> if you imported a tarball.
+
 This invocation of git-debrebase(1) involves a git rebase.  You may
 need to resolve conflicts if the Debian delta queue does not apply
 cleanly to the new upstream source.
diff --git a/dgit-maint-merge.7.pod b/dgit-maint-merge.7.pod
index 0ccd8c7e..17637bad 100644
--- a/dgit-maint-merge.7.pod
+++ b/dgit-maint-merge.7.pod
@@ -166,7 +166,7 @@ Now create I<debian/gbp.conf>:
     [DEFAULT]
     upstream-branch = upstream
     debian-branch = master
-    upstream-tag = %(version)s
+    upstream-tag = upstream/%(version)s
 
     sign-tags = True
     pristine-tar = False
@@ -393,6 +393,8 @@ or if you have a working watch file
 
 =back
 
+In the following, replace I<1.2.3> with I<upstream/1.2.3>.
+
 =head2 Reviewing & merging the release
 
 It's a good idea to preview the merge of the new upstream release.
-- 
2.20.1

From 888f675a6e5b3322a45c06ca2162663edd7cd7b3 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhit...@spwhitton.name>
Date: Wed, 24 Jul 2019 20:08:23 +0100
Subject: [PATCH 2/3] d-m-{merge,debrebase}(7): Set 'merge' in gbp.conf

This enables simplifying runes which are more frequently to be typed.

'merge-mode' no longer need be set since in the only case where the
manpages recommend allowing `gbp import-orig` to perform a merge, a
different merge mode is required (and specified in that rune).

Signed-off-by: Sean Whitton <spwhit...@spwhitton.name>
---
 dgit-maint-debrebase.7.pod | 8 ++++----
 dgit-maint-merge.7.pod     | 7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/dgit-maint-debrebase.7.pod b/dgit-maint-debrebase.7.pod
index 2ac70b57..28406697 100644
--- a/dgit-maint-debrebase.7.pod
+++ b/dgit-maint-debrebase.7.pod
@@ -188,7 +188,7 @@ Now create I<debian/gbp.conf>:
     pristine-tar-commit = False
 
     [import-orig]
-    merge-mode = merge
+    merge = False
 
 =back
 
@@ -208,7 +208,7 @@ Then we can import the upstream version:
 
 =over 4
 
-    % gbp import-orig --merge-mode=replace ../foo_1.2.2.orig.tar.xz
+    % gbp import-orig --merge --merge-mode=replace ../foo_1.2.2.orig.tar.xz
 
 =back
 
@@ -372,7 +372,7 @@ Then, either
 
 =over 4
 
-    % gbp import-orig --no-merge ../foo_1.2.3.orig.tar.xz
+    % gbp import-orig ../foo_1.2.3.orig.tar.xz
 
 =back
 
@@ -380,7 +380,7 @@ or if you have a working watch file
 
 =over 4
 
-    % gbp import-orig --no-merge --uscan
+    % gbp import-orig --uscan
 
 =back
 
diff --git a/dgit-maint-merge.7.pod b/dgit-maint-merge.7.pod
index 17637bad..71cb508c 100644
--- a/dgit-maint-merge.7.pod
+++ b/dgit-maint-merge.7.pod
@@ -174,6 +174,7 @@ Now create I<debian/gbp.conf>:
 
     [import-orig]
     merge-mode = merge
+    merge = False
 
 =back
 
@@ -193,7 +194,7 @@ Then we can import the upstream version:
 
 =over 4
 
-    % gbp import-orig --merge-mode=replace ../foo_1.2.2.orig.tar.xz
+    % gbp import-orig --merge --merge-mode=replace ../foo_1.2.2.orig.tar.xz
 
 =back
 
@@ -381,7 +382,7 @@ Then, either
 
 =over 4
 
-    % gbp import-orig --no-merge ../foo_1.2.3.orig.tar.xz
+    % gbp import-orig ../foo_1.2.3.orig.tar.xz
 
 =back
 
@@ -389,7 +390,7 @@ or if you have a working watch file
 
 =over 4
 
-    % gbp import-orig --no-merge --uscan
+    % gbp import-orig --uscan
 
 =back
 
-- 
2.20.1

From e6dd7f012006456fccfabf14ee3a457a658b95d1 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhit...@spwhitton.name>
Date: Thu, 25 Jul 2019 07:03:36 +0100
Subject: [PATCH 3/3] dgit-maint-debrebase(7): Import tarball before committing
 gbp.conf

The workflow given previously fails to produce a history that can work
with git-debrebase, because it has the first commit introducing
debian/ be an ancestor of the first import of the upstream source.

Signed-off-by: Sean Whitton <spwhit...@spwhitton.name>
---
 dgit-maint-debrebase.7.pod | 64 ++++++++++++++++++++------------------
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/dgit-maint-debrebase.7.pod b/dgit-maint-debrebase.7.pod
index 28406697..475fabeb 100644
--- a/dgit-maint-debrebase.7.pod
+++ b/dgit-maint-debrebase.7.pod
@@ -171,10 +171,37 @@ begin
     % mkdir foo
     % cd foo
     % git init
+    % git checkout -b upstream
+    % gbp import-orig \
+        --upstream-branch=upstream --debian-branch=master \
+        --upstream-tag='upstream/%(version)s' \
+        --sign-tags --no-pristine-tar \
+        ../foo_1.2.2.orig.tar.xz
+    % git branch -f upstream
 
 =back
 
-Now create I<debian/gbp.conf>:
+This should leave you on the master branch.  Next, our upstream branch
+cannot be pushed to B<dgit-repos>, but since we will need it whenever
+we import a new upstream version, we must push it somewhere.  The
+usual choice is B<salsa.debian.org>:
+
+=over 4
+
+    % git remote add -f origin salsa.debian.org:Debian/foo.git
+    % git push --follow-tags -u origin master upstream
+
+=back
+
+You are now ready to proceed as above, making commits to the
+I<debian/> directory and to the upstream source.  As above, for
+technical reasons, B<it is essential that your first commit introduces
+the debian/ directory containing at least one file, and does nothing
+else.>  In other words, make a commit introducing I<debian/> before
+patching the upstream source.
+
+A convenient way to ensure this requirement is satisfied is to start
+by creating I<debian/gbp.conf>:
 
 =over 4
 
@@ -192,43 +219,18 @@ Now create I<debian/gbp.conf>:
 
 =back
 
-gbp-import-orig(1) requires a pre-existing upstream branch:
+and commit that:
 
 =over 4
 
     % git add debian/gbp.conf && git commit -m "create gbp.conf"
-    % git checkout --orphan upstream
-    % git rm -rf .
-    % git commit --allow-empty -m "initial, empty branch for upstream source"
-    % git checkout -f master
 
 =back
 
-Then we can import the upstream version:
-
-=over 4
-
-    % gbp import-orig --merge --merge-mode=replace ../foo_1.2.2.orig.tar.xz
-
-=back
-
-Our upstream branch cannot be pushed to B<dgit-repos>, but since we
-will need it whenever we import a new upstream version, we must push
-it somewhere.  The usual choice is B<salsa.debian.org>:
-
-=over 4
-
-    % git remote add -f origin salsa.debian.org:Debian/foo.git
-    % git push --follow-tags -u origin master upstream
-
-=back
-
-You are now ready to proceed as above, making commits to the
-I<debian/> directory and to the upstream source.  As above, for
-technical reasons, B<it is essential that your first commit introduces
-the debian/ directory containing at least one file, and does nothing
-else.>  In other words, make a commit introducing I<debian/> before
-patching the upstream source.
+Note that we couldn't create I<debian/gbp.conf> before now for the
+same technical reasons which require our first commit to introduce
+I<debian/> without patching the upstream source.  That's why we had to
+pass a lot of options to our first call to gbp-import-orig(1).
 
 =head1 CONVERTING AN EXISTING PACKAGE
 
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to