blob: 4352ddb1cb78968099acacfd7cebc47febd58e5b [file] [log] [blame]
Junio C Hamano415e96c2005-05-15 14:23:12 -07001#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
Junio C Hamano215a7ad2005-09-07 17:26:23 -07006test_description='git-checkout-index -u test.
Junio C Hamano415e96c2005-05-15 14:23:12 -07007
Junio C Hamano215a7ad2005-09-07 17:26:23 -07008With -u flag, git-checkout-index internally runs the equivalent of
9git-update-index --refresh on the checked out entry.'
Junio C Hamano415e96c2005-05-15 14:23:12 -070010
11. ./test-lib.sh
12
13test_expect_success \
14'preparation' '
15echo frotz >path0 &&
Junio C Hamano215a7ad2005-09-07 17:26:23 -070016git-update-index --add path0 &&
Junio C Hamano415e96c2005-05-15 14:23:12 -070017t=$(git-write-tree)'
18
19test_expect_failure \
Junio C Hamano215a7ad2005-09-07 17:26:23 -070020'without -u, git-checkout-index smudges stat information.' '
Junio C Hamano415e96c2005-05-15 14:23:12 -070021rm -f path0 &&
22git-read-tree $t &&
Junio C Hamano215a7ad2005-09-07 17:26:23 -070023git-checkout-index -f -a &&
Junio C Hamano415e96c2005-05-15 14:23:12 -070024git-diff-files | diff - /dev/null'
25
26test_expect_success \
Junio C Hamano215a7ad2005-09-07 17:26:23 -070027'with -u, git-checkout-index picks up stat information from new files.' '
Junio C Hamano415e96c2005-05-15 14:23:12 -070028rm -f path0 &&
29git-read-tree $t &&
Junio C Hamano215a7ad2005-09-07 17:26:23 -070030git-checkout-index -u -f -a &&
Junio C Hamano415e96c2005-05-15 14:23:12 -070031git-diff-files | diff - /dev/null'
Junio C Hamano57fe64a2005-05-19 19:00:36 -070032
33test_done