- if (!
- print " staged your modified .topbloke/msg\n";
- run_git(qw(add .topbloke/msg));
- } else {
- print " left your (partially staged?) .topbloke/msg\n";
+ foreach_unknown_metadata('HEAD',
+ sub { push @meta_to_rm, $_ unless m/^\+/; });
+}
+
+my $baseref = "$baserefs/$newpatch";
+my $currentcommit = run_git_1line(qw(rev-parse), "HEAD");
+create_and_switch($baseref, 'base');
+
+meta_rm_stage('msg');
+meta_and_stage('patch', "$newpatch\n");
+meta_rm_stage('base');
+meta_and_stage('deps', "$current->{DepSpec}\n");
+meta_rm_stage('deleted');
+meta_rm_stage($_) foreach @meta_to_rm;
+
+if ($current->{Kind} eq 'foreign') {
+ meta_and_stage('+included', "");
+ meta_and_stage('+ends', "");
+} else {
+ # we inherit correct contents for +included
+ if ($current->{Kind} eq 'tip') {
+ metafile_process('+ends', undef, sub {
+ die if m/^\Q$current->{Fullname}\E /;
+ }, sub {
+ wf($_->[0], "$current->{Fullname} $currentcommit\n");
+ }, undef);
+ stage_meta('+ends');