t / t7106-reset-unborn-branch.shon commit upload-pack: support hidden refs with protocol v2 (e20b419)
   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
  15        git ls-files >actual &&
  16        test_must_be_empty actual
  17'
  18
  19test_expect_success 'reset HEAD' '
  20        rm .git/index &&
  21        git add a b &&
  22        test_must_fail git reset HEAD
  23'
  24
  25test_expect_success 'reset $file' '
  26        rm .git/index &&
  27        git add a b &&
  28        git reset a &&
  29
  30        echo b >expect &&
  31        git ls-files >actual &&
  32        test_cmp expect actual
  33'
  34
  35test_expect_success PERL 'reset -p' '
  36        rm .git/index &&
  37        git add a &&
  38        echo y >yes &&
  39        git reset -p <yes >output &&
  40
  41        git ls-files >actual &&
  42        test_must_be_empty actual &&
  43        test_i18ngrep "Unstage" output
  44'
  45
  46test_expect_success 'reset --soft is a no-op' '
  47        rm .git/index &&
  48        git add a &&
  49        git reset --soft &&
  50
  51        echo a >expect &&
  52        git ls-files >actual &&
  53        test_cmp expect actual
  54'
  55
  56test_expect_success 'reset --hard' '
  57        rm .git/index &&
  58        git add a &&
  59        test_when_finished "echo a >a" &&
  60        git reset --hard &&
  61
  62        git ls-files >actual &&
  63        test_must_be_empty actual &&
  64        test_path_is_missing a
  65'
  66
  67test_done