t / t2104-update-index-skip-worktree.shon commit fetch: add --unshallow for turning shallow repo into complete one (4dcb167)
   1#!/bin/sh
   2#
   3# Copyright (c) 2008 Nguyễn Thái Ngọc Duy
   4#
   5
   6test_description='skip-worktree bit test'
   7
   8. ./test-lib.sh
   9
  10cat >expect.full <<EOF
  11H 1
  12H 2
  13H sub/1
  14H sub/2
  15EOF
  16
  17cat >expect.skip <<EOF
  18S 1
  19H 2
  20S sub/1
  21H sub/2
  22EOF
  23
  24test_expect_success 'setup' '
  25        mkdir sub &&
  26        touch ./1 ./2 sub/1 sub/2 &&
  27        git add 1 2 sub/1 sub/2 &&
  28        git ls-files -t | test_cmp expect.full -
  29'
  30
  31test_expect_success 'index is at version 2' '
  32        test "$(test-index-version < .git/index)" = 2
  33'
  34
  35test_expect_success 'update-index --skip-worktree' '
  36        git update-index --skip-worktree 1 sub/1 &&
  37        git ls-files -t | test_cmp expect.skip -
  38'
  39
  40test_expect_success 'index is at version 3 after having some skip-worktree entries' '
  41        test "$(test-index-version < .git/index)" = 3
  42'
  43
  44test_expect_success 'ls-files -t' '
  45        git ls-files -t | test_cmp expect.skip -
  46'
  47
  48test_expect_success 'update-index --no-skip-worktree' '
  49        git update-index --no-skip-worktree 1 sub/1 &&
  50        git ls-files -t | test_cmp expect.full -
  51'
  52
  53test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
  54        test "$(test-index-version < .git/index)" = 2
  55'
  56
  57test_done