chiark / gitweb /
Test suite: tartree-edit: gitfetchinfo: Be a bit more careful
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 2 Jul 2016 10:33:26 +0000 (11:33 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 2 Jul 2016 10:35:35 +0000 (11:35 +0100)
* Turn on perl warnings
* Use strict
* When removing old merged refs, insist that we aren't handling A+A

tests/tartree-edit

index cecc142..cdaade3 100755 (executable)
@@ -128,7 +128,8 @@ tryat_gitfetchinfo () {
        local innerwd="$(echo $play/*)"
 
        git for-each-ref --format='%(refname)' refs/remotes >$play/l
-       perl -ne '
+       perl -w -ne '
+           use strict;
            chomp;
            next unless m#^refs/remotes/([^/]+)/#;
            my $old = $_;
@@ -136,7 +137,8 @@ tryat_gitfetchinfo () {
            my $rhs = $'\'';
            my @ab = split /\+/, $ab;
            next unless @ab == 2;
-           next unless grep { $_ eq "'"$remote"'" } @ab;
+           next unless (grep { $_ eq "'"$remote"'" } @ab) == 1;
+           $remerge{"@ab"} = 1;
            print "update refs/remotes/$_/$rhs $old\n" or die $! foreach @ab;
            print "delete $old\n" or die $!;
        ' <$play/l >$play/unmerge