chiark / gitweb /
git-debrebase: Recognise anchors by commit annotation, only
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 18 Feb 2018 12:02:04 +0000 (12:02 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 15:06:58 +0000 (16:06 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
NOTES.git-debrebase
git-debrebase

index 476120fd1e6c4f401e2d527d0961486ae84412e2..ca78c9386414aeff95a719b7ca2d37642051194b 100644 (file)
@@ -1,5 +1,7 @@
 TODO
-   recognise anchor merge by annotation, not just by structure
+   --anchor option to specify commit(s) to treat as as anchor(s)
+
+   rename "launder" operation to "launder-v0"
 
    reference docs
       git-debrebase(5)   data model
index 92fa86b7483ca92cea57de2bafb7835573068961..bc98756f514a4e0b786329d20ef00e4d38a774d1 100755 (executable)
@@ -412,7 +412,7 @@ sub classify ($) {
 
        my $badanchor = sub { $unknown->("git-debrebase \`anchor' but @_"); };
        @p == 2 or return $badanchor->("has other than two parents");
-       $haspatches and return $unknown->("contains debian/patches");
+       $haspatches and return $badanchor->("contains debian/patches");
 
        # How to decide about l/r ordering of anchors ?  git
        # --topo-order prefers to expand 2nd parent first.  There's
@@ -421,26 +421,14 @@ sub classify ($) {
        # way also there's also an easy rune to look for the upstream
        # patches (--topo-order).
 
-       # The above tells us which way *we* will generate them.  But we
-       # might encounter ad-hoc anchor merges generated manually,
-       # which might be the other way around.  In principle, in some odd
-       # situations, an anchor merge might have two identical parents.
-       # In that case we guess which way round it is (ie, which parent
-       # has the upstream history).  The order of the 2-iteration loop
-       # controls which guess we make.
-
-       # XXX we are going to desupport non-git-debrebase-generated anchors
-
-       foreach my $prevbrw (qw(0 1)) {
-           if (!$p[$prevbrw]{IsOrigin} && # breakwater never starts with an origin
-               !($p[!$prevbrw]{Differs} & ~DS_DEB) && # no non-debian changess
-               !($p[$prevbrw]{Differs} & ~D_UPS)) { # no non-upstream changes
-               return $classify->(qw(Anchor),
-                                  OrigParents => [ $p[!$prevbrw] ]);
-           }
-       }
+       $p[0]{IsOrigin} and $badanchor->("is an origin commit");
+       $p[1]{Differs} & ~DS_DEB and
+           $badanchor->("upstream files differ from left parent");
+       $p[0]{Differs} & ~D_UPS and
+           $badanchor->("debian/ differs from right parent");
 
-       $badanchor->("violation");
+       return $classify->(qw(Anchor),
+                          OrigParents => [ $p[1] ]);
     }
 
     if (@p == 1) {