chiark / gitweb /
git-debrebase: Break out record_gdrlast
[dgit.git] / git-debrebase
index 3be444b935e4af4e02a2e50e2e61cbf0230e4b81..8e347f15843b71deb7ad9e0450ce37478a2c8b93 100755 (executable)
@@ -196,6 +196,8 @@ sub get_tree ($;$$) {
        return () if $type eq 'missing';
     }
 
+    confess "get_tree needs object not $x ?" unless $x =~ m{^[0-9a-f]+\:};
+
     our (@get_tree_memo, %get_tree_memo);
     my $memo = $get_tree_memo{$x};
     return @$memo if $memo;
@@ -426,6 +428,11 @@ sub any_snags () {
     return $snags_forced || $snags_tripped;
 }
 
+sub record_gdrlast ($$) {
+    my ($gdrlast, $newvalue) = @_;
+    push @deferred_updates, "update $gdrlast $newvalue $git_null_obj";
+}
+
 sub gbp_pq_export ($$$) {
     my ($bname, $base, $tip) = @_;
     # must be run in a workarea.  $bname and patch-queue/$bname
@@ -1879,8 +1886,7 @@ sub stitch ($$$$$) {
            # ffq-prev is ahead of us, and the only tree changes it has
            # are possibly addition of things in debian/patches/.
            # Just wind forwards rather than making a pointless pseudomerge.
-           push @deferred_updates,
-               "update $gdrlast $ffq_prev_commitish $git_null_obj";
+           record_gdrlast $gdrlast, $ffq_prev_commitish;
            update_head_checkout $old_head, $ffq_prev_commitish,
                "stitch (fast forward)";
            return;
@@ -1893,7 +1899,7 @@ sub stitch ($$$$$) {
        'Declare fast forward / record previous work',
         "[git-debrebase pseudomerge: $prose]",
     ];
-    push @deferred_updates, "update $gdrlast $new_head $git_null_obj";
+    record_gdrlast $gdrlast, $new_head;
     update_head $old_head, $new_head, "stitch: $prose";
 }