chiark / gitweb /
wip; before reject dirty cache in create
[topbloke.git] / tb-create.pl
index 591a72e0bb397b4264e073c1986b8c842a1a8a1a..fcacc6f13410cade3921d6efdb2e529333a16804 100755 (executable)
@@ -59,30 +59,32 @@ printf "creating %s\n", $newbranch;
 
 setup_config();
 
+run_git__anyoutput(qw(diff --cached --name-only HEAD --
+
 if (!run_git_test_anyoutput(qw(diff --name-only HEAD -- .topbloke/msg)) {
-    open NM, '>', ".topbloke/msg.tmp" or die $!;
+    my $nm = wf_start('.topbloke/msg');
     my $author = run_git_1line(qw(var GIT_AUTHOR_IDENT));
     $author =~ s/ \d+ [-+]\d+$//;
-    print NM "From: $author\n" or die $!;
+    wf($nm, "From: $author\n");
     foreach my $h (qw(To CC BCC)) {
        my $estatus;
-       run_git(\$estatus, sub { print NM "$h: $_" or die $!; },
+       run_git(\$estatus, sub { wf($nm, "$h: $_") or die $!; },
                qw(config), "topbloke.".lc $h);
        die "$h $estatus" unless $estatus==0 || $estatus==256;
     }
     $subjprefix = git_config('topbloke.subjectprefix', '');
-    print NM <END or die $!;
+    wf($n, <END) or die $!;
 Subject: [${subprefix}PATCH] $spec->{Nick}
 
 <patch description>
 
 Signed-off-by: $author
 END
+    wf_done($nm);
     run_git(qw(add .topbloke/msg));
     print " created and staged new .topbloke/msg\n";
 } else {
-    if (!run_git_test_anyoutput(qw(diff --cached --name-only HEAD --
-                                  .topblokemsg))) {
+    if (!
        print " staged your modified .topbloke/msg\n";
        run_git(qw(add .topbloke/msg));
     } else {
@@ -90,3 +92,15 @@ END
     }
 }
 
+sub meta_and_stage ($$) {
+    my ($file, $contents) = @_;
+    wf_contents(".topbloke/$file", $contents);
+    run_git(qw(add), ".topbloke/$file");
+}
+
+meta_and_stage("deps", $current->{DepSpec}."\n");
+meta_and_stage("flags", '');
+
+if ($current->{Kind} eq 'foreign') {
+    meta_and_stage('included', $current->{DepSpec});
+