chiark / gitweb /
dgit-badcommit-fixup: Break out filter_updates
[dgit.git] / dgit-badcommit-fixup
index ec6f57c78395f6f9c5a4debf767fa5bc6911da19..46637899d91920f234cb78bb27b4f7eb58af912b 100755 (executable)
@@ -104,6 +104,12 @@ sub rewrite_commit ($) {
     return $newobj;
 }
 
+our @updates;
+
+sub filter_updates () {
+    @updates = grep { $_->[1] ne $_->[2] } @updates;
+}
+
 sub rewrite_tag ($) {
     my ($obj) = @_;
     $_ = getobj $obj, 'tag';
@@ -129,8 +135,6 @@ die "$? $!" if $?;
 
 chomp $refs;
 
-our @updates;
-
 foreach my $rline (split /\n/, $refs) {
     my ($obj, $type, $refname) = 
        $rline =~ m/^(\w+)\s+(\w+)\s+(\S.*)/
@@ -147,9 +151,7 @@ foreach my $rline (split /\n/, $refs) {
     push @updates, [ $refname, $obj, $rewrite ];
 }
 
-our $worktree;
-
-@updates = grep { $_->[1] ne $_->[2] } @updates;
+filter_updates();
 
 #print Dumper(\@updates);