t / t7106-reset-unborn-branch.shon commit add tests for rebasing of empty commits (00b8be5)
   1#!/bin/sh
   2
   3test_description='git reset should work on unborn branch'
   4. ./test-lib.sh
   5
   6test_expect_success 'setup' '
   7        echo a >a &&
   8        echo b >b
   9'
  10
  11test_expect_success 'reset' '
  12        git add a b &&
  13        git reset &&
  14        test "$(git ls-files)" = ""
  15'
  16
  17test_expect_success 'reset HEAD' '
  18        rm .git/index &&
  19        git add a b &&
  20        test_must_fail git reset HEAD
  21'
  22
  23test_expect_success 'reset $file' '
  24        rm .git/index &&
  25        git add a b &&
  26        git reset a &&
  27        test "$(git ls-files)" = "b"
  28'
  29
  30test_expect_success 'reset -p' '
  31        rm .git/index &&
  32        git add a &&
  33        echo y | git reset -p &&
  34        test "$(git ls-files)" = ""
  35'
  36
  37test_expect_success 'reset --soft is a no-op' '
  38        rm .git/index &&
  39        git add a &&
  40        git reset --soft
  41        test "$(git ls-files)" = "a"
  42'
  43
  44test_expect_success 'reset --hard' '
  45        rm .git/index &&
  46        git add a &&
  47        git reset --hard &&
  48        test "$(git ls-files)" = "" &&
  49        test_path_is_missing a
  50'
  51
  52test_done