chiark / gitweb /
git-debrebase: wip stitch
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 Feb 2018 20:18:24 +0000 (20:18 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 11:25:49 +0000 (12:25 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase
tests/tests/gdr-edits

index 19beef8c3ffc422eba8e7468e43ac2ccb29ecb6b..5fcec5461a2e51143de9818b50ad09aa6e0516db 100755 (executable)
@@ -29,6 +29,7 @@
 #    git-debrebase [<options> --] [<git-rebase options...>]
 #    git-debrebase [<options>] analyse
 #    git-debrebase [<options>] launder         # prints breakwater tip etc.
+#    git-debrebase [<options>] stitch [--prose=<for commit message>]
 #    git-debrebase [<options>] downstream-rebase-launder-v0  # experimental
 #
 #    git-debrebase [<options>] gbp2debrebase-v0 \
@@ -1136,6 +1137,30 @@ sub cmd_record_ffq_prev () {
     }
 }
 
+sub cmd_stitch () {
+    my $prose = '';
+    GetOptions('prose=s', \$prose) or die badusage("bad options to stitch");
+    badusage "no arguments allowed" if @ARGV;
+    my ($status, $message, $current, $ffq_prev) = ffq_prev_branchinfo();
+    if ($status ne 'branch') {
+       fproblem $status, "could not check ffq-prev: $message";
+       fproblems_maybe_bail();
+    }
+    my $prev = $ffq_prev && git_get_ref $ffq_prev;
+    if (!$prev) {
+       fail "No ffq-prev to stitch." unless $opt_noop_ok;
+    }
+    $prose = ", $prose" if length $prose;
+    runcmd @git, qw(merge -s ours --no-edit -m), <<END;
+Declare fast forward / record previous work
+
+[git-debrebase pseudomerge: stitch$prose]
+END
+    # xxx should delete old ffq-prev
+    # xxx should avoid making pseudomerge if not needed
+    # xxx should make pseudomerge in temp tree so can do atomic update
+}
+
 sub cmd_gbp2debrebase () {
     badusage "needs 1 optional argument, the upstream" unless @ARGV<=1;
     my ($upstream_spec) = @ARGV;
index bab3a3dce67477eae5dd5f580c6c6ae199a70e40..8bfbfc61b2ddadca5c5afbc56328aff3ec840bb0 100755 (executable)
@@ -30,4 +30,6 @@ t-git-debrebase
 
 git diff t.before -- ':.' ':!debian/patches'
 
+t-git-debrebase stitch --prose=wombat
+
 t-ok