@ISA = qw(Exporter);
@EXPORT = qw(debug
run_git run_git_1line run_git_check_nooutput
- run_git_test_anyoutput
+ run_git_test_anyoutput git_get_object
git_config git_dir chdir_toplevel
- current_branch parse_patch_spec
+ current_branch parse_patch_spec parse_patch_name
setup_config check_no_unwanted_metadata
+ patch_matches_spec
foreach_patch
flagsfile_add_flag
- wf_start wf wf_abort wf_done wf_contents);
+ wf_start wf wf_abort wf_done wf_contents
+ closeout);
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
}
$git_command, qw(cat-file --batch))
or die $!;
}
+ #debug("git_get_object $objname");
$SIG{'PIPE'} = 'IGN';
print $gro_in $objname,"\n" or die $!;
$gro_in->flush or die "$objname $!";
$SIG{'PIPE'} = 'DFL';
my $l = <$gro_out>;
chomp $l or die "$objname $l ?";
+ #debug("git_get_object $objname => $l");
if ($l =~ m/ missing$/) {
return 'missing';
} elsif (my ($type,$bytes) = $l =~ m/^\S+ (\w+) (\d+)$/) {
- my $data;
- read $gro_out, $data, $bytes == $bytes or die "$objname $!";
+ my $data = '';
+ if ($bytes) {
+ (read $gro_out, $data, $bytes) == $bytes or die "$objname $!";
+ }
+ my $nl;
+ (read $gro_out, $nl, 1) == 1 or die "$objname $!";
+ $nl eq "\n" or die "$objname ?";
return ($type, $data);
} else {
die "$objname $l";
};
}
if ($ref =~ m#^refs/topbloke-(tip|base)s/([^/\@]*)\@([^/\@]*)/([^/]*)/#) {
+ my $fullname = "$2\@$3/$4/$'";
return {
Kind => $1,
Email => $2,
Date => $4,
Nick => $', #',
Ref => $ref,
- DepSpec => "$2\@$3/$4/$'",
+ DepSpec => $fullname,
+ Fullname => $fullname,
};
} elsif ($ref =~ m#^refs/heads/#) {
return {
Domain => $domain,
Date => $date,
Nick => $nick,
+ Kind => 'tip',
+ DepSpec => $patch,
+ Fullname => $patch,
+ Ref => "refs/topbloke-tips/$patch",
};
}
wf_done($wf);
}
+sub closeout () {
+ STDOUT->error and die $!;
+ close STDOUT or die $!;
+}
+
1;