sha1-file.c: mark more strings for translation
[gitweb.git] / t / t3430-rebase-merges.sh
index 35260862fcb759c9f29ded4fcf3ba0f19628631b..78f7c9958030bee8d8040eda0380ba5af16d0441 100755 (executable)
@@ -275,4 +275,58 @@ test_expect_success 'root commits' '
        test_cmp_rev HEAD $before
 '
 
+test_expect_success 'a "merge" into a root commit is a fast-forward' '
+       head=$(git rev-parse HEAD) &&
+       cat >script-from-scratch <<-EOF &&
+       reset [new root]
+       merge $head
+       EOF
+       test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
+       test_tick &&
+       git rebase -i -r HEAD^ &&
+       test_cmp_rev HEAD $head
+'
+
+test_expect_success 'A root commit can be a cousin, treat it that way' '
+       git checkout --orphan khnum &&
+       test_commit yama &&
+       git checkout -b asherah master &&
+       test_commit shamkat &&
+       git merge --allow-unrelated-histories khnum &&
+       test_tick &&
+       git rebase -f -r HEAD^ &&
+       ! test_cmp_rev HEAD^2 khnum &&
+       test_cmp_graph HEAD^.. <<-\EOF &&
+       *   Merge branch '\''khnum'\'' into asherah
+       |\
+       | * yama
+       o shamkat
+       EOF
+       test_tick &&
+       git rebase --rebase-merges=rebase-cousins HEAD^ &&
+       test_cmp_graph HEAD^.. <<-\EOF
+       *   Merge branch '\''khnum'\'' into asherah
+       |\
+       | * yama
+       |/
+       o shamkat
+       EOF
+'
+
+test_expect_success 'labels that are object IDs are rewritten' '
+       git checkout -b third B &&
+       test_commit I &&
+       third=$(git rev-parse HEAD) &&
+       git checkout -b labels master &&
+       git merge --no-commit third &&
+       test_tick &&
+       git commit -m "Merge commit '\''$third'\'' into labels" &&
+       echo noop >script-from-scratch &&
+       test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
+       test_tick &&
+       git rebase -i -r A &&
+       grep "^label $third-" .git/ORIGINAL-TODO &&
+       ! grep "^label $third$" .git/ORIGINAL-TODO
+'
+
 test_done