chiark / gitweb /
CONVERSION MODE NOT FINISHE
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 17 Jan 2019 18:57:56 +0000 (18:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 17 Jan 2019 18:58:20 +0000 (18:58 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 1aa56d1017c6c2a258bec7143c3c2e6d7762d74a..a1f3ded0c5576d446c827dbb43389fbb22bb63fa 100755 (executable)
@@ -2539,6 +2539,7 @@ sub complete_convert_from ($$$$) {
 
 sub cmd_convert_from_unapplied () { convert_from_some_unapplied(0); }
 sub cmd_convert_from_gbp () { convert_from_some_unapplied(0); }
+sub cmd_convert_from_bare_debian () { convert_from_some_unapplied(1); }
 
 sub convert_from_some_unapplied ($) {
     my ($bare) = @_;
@@ -2557,31 +2558,39 @@ sub convert_from_some_unapplied ($) {
 
     my ($old_head, $gdrlastinfo) = begin_convert_from();
 
-    my $upsdiff = get_differs $upstream, $old_head;
-    if ($upsdiff & D_UPS) {
-       runcmd @git, qw(--no-pager diff --stat),
-           $upstream, $old_head,
-           qw( -- :!/debian :/);
-       fail f_ <<END, $upstream_spec, $upstream_spec;
+    if ($bare) {
+       snag 'unfinished-conversion-mode', <<END
+The convert-from-bare-debian mode is not very finished.  In particular it does not check that the input branch was in fact bare.  Nor does it check that the upstream branch you provided was correct (not sure how it could).  So on your head be it.
+END
+    }
+
+    if (!$bare) {
+       my $upsdiff = get_differs $upstream, $old_head;
+       if ($upsdiff & D_UPS) {
+           runcmd @git, qw(--no-pager diff --stat),
+               $upstream, $old_head,
+               qw( -- :!/debian :/);
+           fail f_ <<END, $upstream_spec, $upstream_spec;
 upstream (%s) and HEAD are not
 identical in upstream files.  See diffstat above, or run
   git diff %s HEAD -- :!/debian :/
 END
-    }
+       }
 
-    if (!is_fast_fwd $upstream, $old_head) {
-       snag 'upstream-not-ancestor',
-           f_ "upstream (%s) is not an ancestor of HEAD", $upstream;
-    } else {
-       my $wrong = cmdoutput
-           (@git, qw(rev-list --ancestry-path), "$upstream..HEAD",
-            qw(-- :/ :!/debian));
-       if (length $wrong) {
-           snag 'unexpected-upstream-changes', f_
-               "history between upstream (%s) and HEAD contains direct changes to upstream files - are you sure this is a gbp (patches-unapplied) branch?",
-               $upstream;
-           print STDERR f_ "list expected changes with:  %s\n", 
- "git log --stat --ancestry-path $upstream_spec..HEAD -- :/ ':!/debian'";
+       if (!is_fast_fwd $upstream, $old_head) {
+           snag 'upstream-not-ancestor',
+               f_ "upstream (%s) is not an ancestor of HEAD", $upstream;
+       } else {
+           my $wrong = cmdoutput
+               (@git, qw(rev-list --ancestry-path), "$upstream..HEAD",
+                qw(-- :/ :!/debian));
+           if (length $wrong) {
+               snag 'unexpected-upstream-changes', f_
+                   "history between upstream (%s) and HEAD contains direct changes to upstream files - are you sure this is a gbp (patches-unapplied) branch?",
+                   $upstream;
+               print STDERR f_ "list expected changes with:  %s\n", 
+                   "git log --stat --ancestry-path $upstream_spec..HEAD -- :/ ':!/debian'";
+           }
        }
     }
 
@@ -2640,11 +2649,17 @@ END
 
     fresh_workarea();
     in_workarea sub {
-       runcmd @git, qw(checkout -q -b gdr-internal), $old_head;
+       if ($bare) {
+           runcmd @git, qw(checkout -q -b gdr-internal), $upstream;
+           read_tree_debian $old_head;
+           runcmd @git, qw(commit --allow-empty -q -m ADD-DEBIAN);
+       } else {
+           runcmd @git, qw(checkout -q -b gdr-internal), $old_head;
+       }
        # make a branch out of the patch queue - we'll want this in a mo
        runcmd qw(gbp pq import);
        # strip the patches out
-       runcmd @git, qw(checkout -q gdr-internal~0);
+       runcmd @git, qw(checkout -q), $old_head;
        rm_subdir_cached 'debian/patches';
        $work = make_commit ['HEAD'], [
  'git-debrebase convert-from-gbp: drop patches from tree',