t / t2002-checkout-cache-u.shon commit Merge git://git.kernel.org/pub/scm/gitk/gitk (a549e11)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='git-checkout-index -u test.
   7
   8With -u flag, git-checkout-index internally runs the equivalent of
   9git-update-index --refresh on the checked out entry.'
  10
  11. ./test-lib.sh
  12
  13test_expect_success \
  14'preparation' '
  15echo frotz >path0 &&
  16git-update-index --add path0 &&
  17t=$(git-write-tree)'
  18
  19test_expect_failure \
  20'without -u, git-checkout-index smudges stat information.' '
  21rm -f path0 &&
  22git-read-tree $t &&
  23git-checkout-index -f -a &&
  24git-diff-files | diff - /dev/null'
  25
  26test_expect_success \
  27'with -u, git-checkout-index picks up stat information from new files.' '
  28rm -f path0 &&
  29git-read-tree $t &&
  30git-checkout-index -u -f -a &&
  31git-diff-files | diff - /dev/null'
  32
  33test_done