summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-04-04 10:56:24 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-04-04 10:56:24 -0700
commit909d5b646e9bb49c9c242c82d68e29c451988541 (patch)
tree8e1a0cb2957d75a2bf09ffe5b454acdcb0ba0ff7 /t
parentMerge branch 'jh/builtin-fsmonitor-part2' (diff)
parentmv: refresh stat info for moved entry (diff)
downloadtgif-909d5b646e9bb49c9c242c82d68e29c451988541.tar.xz
Merge branch 'vd/mv-refresh-stat'
"git mv" failed to refresh the cached stat information for the entry it moved. * vd/mv-refresh-stat: mv: refresh stat info for moved entry
Diffstat (limited to 't')
-rwxr-xr-xt/t7001-mv.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 963356ba5f..a402908142 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -4,6 +4,25 @@ test_description='git mv in subdirs'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff-data.sh
+test_expect_success 'mv -f refreshes updated index entry' '
+ echo test >bar &&
+ git add bar &&
+ git commit -m test &&
+
+ echo foo >foo &&
+ git add foo &&
+
+ # Wait one second to ensure ctime of rename will differ from original
+ # file creation ctime.
+ sleep 1 &&
+ git mv -f foo bar &&
+ git reset --merge HEAD &&
+
+ # Verify the index has been reset
+ git diff-files >out &&
+ test_must_be_empty out
+'
+
test_expect_success 'prepare reference tree' '
mkdir path0 path1 &&
COPYING_test_data >path0/COPYING &&