diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-06-04 12:23:16 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-07-16 16:47:47 +0100 |
commit | ea2e4102e8f2f461443978240a18cc3ea011b9bd (patch) | |
tree | d79fac1e7e9c768d153a9d5d3ac5c3adb2109e41 /dgit | |
parent | 40f9216be3a35fe378b6cdb5077fea52a3445bbd (diff) |
Split brain: Detect patches-unapplied tree and print a suitable message
Note that the message refers to `--quilt=gbp' aka `--quilt=apply'
which do not exist yet (and which we're going to call something else,
later in this series). Oh well.
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 34 |
1 files changed, 30 insertions, 4 deletions
@@ -2533,6 +2533,13 @@ sub quiltify_tree_sentinelfiles ($) { return $r; } +sub quilt_could_gbp ($$$) { + my ($userhead,$unapplied,$applied) = @_; + return + !quiltify_trees_differ($userhead,$unapplied,1) && + quiltify_trees_differ($userhead,$applied,1); +} + sub quiltify ($$$) { my ($clogp,$target,$unapplied) = @_; @@ -2678,6 +2685,12 @@ sub quiltify ($$$) { foreach my $notp (@nots) { print STDERR "$us: ", $reportnot->($notp), "\n"; } + if (quilt_could_gbp($target,$unapplied,$oldtiptree)) { + print STDERR <<END; +$us: Tree looks like a patches-unapplied git branch. +$us: Maybe you forgot --quilt=gbp (aka --quilt=apply) ? +END + } fail "quilt fixup naive history linearisation failed.\n". "Use dpkg-source --commit by hand; or, --quilt=smash for one ugly patch"; } elsif ($quilt_mode eq 'smash') { @@ -2884,11 +2897,24 @@ sub quilt_fixup_multipatch ($$$) { # 6. Back in the main tree, fast forward to the new HEAD # Another situation we may have to cope with is gbp-style - # patches-unapplied trees. We want to detect these, so we know - # to escape into quilt_fixup_gbp. + # patches-unapplied trees. + # + # We would want to detect these, so we know to escape into + # quilt_fixup_gbp. However, this is in general not possible. + # Consider a package with a one patch which the dgit user reverts + # (with git-revert or the moral equivalent). + # + # That is indistinguishable in contents from a patches-unapplied + # tree. And looking at the history to distinguish them is not + # useful because the user might have made a confusing-looking git + # history structure (which ought to produce an error if dgit can't + # cope, not a silent reintroduction of an unwanted patch). # - # A gbp-style tree is one which is not a clean patches-applied - # tree, but _is_ a clean patches-unapplied tree. + # So gbp users will have to pass an option. But we can usually + # detect their failure to do so: if the tree is not a clean + # patches-applied tree, quilt linearisation fails, but the tree + # _is_ a clean patches-unapplied tree, we can suggest that maybe + # they want --quilt=unapplied. # # To help detect this, when we are extracting the fake dsc, we # first extract it with --skip-patches, and then apply the patches |