git_config git_dir chdir_toplevel
current_branch parse_branch_spec
setup_config check_no_unwanted_metadata
+ flagsfile_add_flag
wf_start wf wf_abort wf_done wf_contents);
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
qw(.topbloke));
}
+sub flagsfile_add_flag ($$) {
+ # works on "deps" too
+ my ($flagsfile, $flag) = @_;
+ my $wf = wf_start(".topbloke/$flagsfile");
+ open FI, '<', ".topbloke/$flagsfile" or die $!;
+ while (<FI>) {
+ chomp or die;
+ die "flag $flag already set in $flagsfile ?!" if $_ eq $flag;
+ wf($wf, "$_\n");
+ }
+ FI->error and die $!;
+ close FI or die $!;
+ wf($wf, "$flag\n");
+ wf_done($wf);
+}
+
sub wf_start ($) {
my ($path) = @_;
my $fh = new IO::File "$path.tmp", '>' or die "create $path.tmp: $!\n";
meta_and_stage('flags', '');
if ($current->{Kind} eq 'foreign') {
- meta_and_stage('included', $current->{DepSpec});
+ meta_and_stage('included', $current->{DepSpec}."\n");
meta_and_stage('pflags', '');
}
meta_and_stage('deps', "$current->{DepSpec}\n");
# we inherit empty flags from the base branch
-open I, '>>', ".topbloke/included" or die $!;
-print I "$newbranch\n";
-close I or die $!;
+flagsfile_add_flag('included',$newbranch);
stage_meta('included');
run_git(qw(commit -q -m), "create branch $spec->{Nick}\n$newbranch\n");
-
-
-INCLUDED IS WRONG MISSING NEWLINE