t / t3513-revert-submodule.shon commit config: work around bug with includeif:onbranch and early config (85fe0e8)
   1#!/bin/sh
   2
   3test_description='revert can handle submodules'
   4
   5. ./test-lib.sh
   6. "$TEST_DIRECTORY"/lib-submodule-update.sh
   7
   8# Create a revert that moves from HEAD (including any test modifications to
   9# the work tree) to $1 by first checking out $1 and reverting it. Reverting
  10# the revert is the transition we test for. We tar the current work tree
  11# first so we can restore the work tree test setup after doing the checkout
  12# and revert.  We test here that the restored work tree content is identical
  13# to that at the beginning. The last revert is then tested by the framework.
  14git_revert () {
  15        git status -su >expect &&
  16        ls -1pR * >>expect &&
  17        tar cf "$TRASH_DIRECTORY/tmp.tar" * &&
  18        git checkout "$1" &&
  19        git revert HEAD &&
  20        rm -rf * &&
  21        tar xf "$TRASH_DIRECTORY/tmp.tar" &&
  22        git status -su >actual &&
  23        ls -1pR * >>actual &&
  24        test_cmp expect actual &&
  25        git revert HEAD
  26}
  27
  28KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
  29test_submodule_switch "git_revert"
  30
  31test_done