+ changedir '../fake';
+ rmtree '.pc';
+ runcmd @git, qw(add -Af .);
+ my $oldtiptree=git_write_tree();
+ changedir '../work';
+
+
+ # We calculate some guesswork now about what kind of tree this might
+ # be. This is mostly for error reporting.
+
+ my $user2unapplied = quiltify_trees_differ($headref, $unapplied, 1);
+ my $user2applied = quiltify_trees_differ($headref, $oldtiptree,1);
+ my $applied2unapplied = quiltify_trees_differ($oldtiptree,$unapplied, 1);
+
+ my @dl;
+ foreach my $b (qw(01 02)) {
+ foreach my $v ($user2unapplied, $applied2unapplied, $user2applied) {
+ push @dl, ($v & $b) ? '##' : '==';
+ }
+ }
+ printdebug "differences \@dl @dl.\n";
+
+ progress sprintf
+"$us: quilt differences: src: %s orig %s gitignores: %s orig %s\n".
+"$us: quilt differences: HEAD %s o+d/p HEAD %s o+d/p",
+ $dl[0], $dl[1], $dl[3], $dl[4],
+ $dl[2], $dl[5];
+
+ my @failsuggestion;
+ if (!($user2unapplied & $applied2unapplied)) {
+ push @failsuggestion, "This might be a patches-unapplied branch.";
+ } elsif (!($user2applied & $applied2unapplied)) {
+ push @failsuggestion, "This might be a patches-applied branch.";
+ }
+ push @failsuggestion, "Maybe you need to specify one of".
+ " --quilt=gbp --quilt=dpm --quilt=unapplied ?";
+
+ if ($quilt_mode =~ m/gbp|dpm|apply/) {
+ quiltify_splitbrain();
+ return;
+ }
+
+ quiltify($clogp,$headref,$oldtiptree,\@failsuggestion);