t / t3426-rebase-submodule.shon commit pathspec: create strip submodule slash helpers (5590215)
   1#!/bin/sh
   2
   3test_description='rebase can handle submodules'
   4
   5. ./test-lib.sh
   6. "$TEST_DIRECTORY"/lib-submodule-update.sh
   7. "$TEST_DIRECTORY"/lib-rebase.sh
   8
   9git_rebase () {
  10        git status -su >expect &&
  11        ls -1pR * >>expect &&
  12        git checkout -b ours HEAD &&
  13        echo x >>file1 &&
  14        git add file1 &&
  15        git commit -m add_x &&
  16        git revert HEAD &&
  17        git status -su >actual &&
  18        ls -1pR * >>actual &&
  19        test_cmp expect actual &&
  20        git rebase "$1"
  21}
  22
  23test_submodule_switch "git_rebase"
  24
  25git_rebase_interactive () {
  26        git status -su >expect &&
  27        ls -1pR * >>expect &&
  28        git checkout -b ours HEAD &&
  29        echo x >>file1 &&
  30        git add file1 &&
  31        git commit -m add_x &&
  32        git revert HEAD &&
  33        git status -su >actual &&
  34        ls -1pR * >>actual &&
  35        test_cmp expect actual &&
  36        set_fake_editor &&
  37        echo "fake-editor.sh" >.git/info/exclude &&
  38        git rebase -i "$1"
  39}
  40
  41KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
  42# The real reason "replace directory with submodule" fails is because a
  43# directory "sub1" exists, but we reuse the suppression added for merge here
  44test_submodule_switch "git_rebase_interactive"
  45
  46test_done