Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClemens Buchacher <drizzd@aon.at>2010-05-01 13:25:12 +0400
committerJunio C Hamano <gitster@pobox.com>2010-05-01 23:00:44 +0400
commitaecda37c66ecf215fc67b0b48998a8c69c10d5a5 (patch)
tree407e3028610895da47c16d6c29c0cc72b1385524 /t/t2106-update-index-assume-unchanged.sh
parente92e9cd3c388544f4f521736df844b37908c3879 (diff)
do not overwrite files marked "assume unchanged"
A merge will fail gracefully if it needs to update files marked "assume unchanged", but other similar commands will not. In particular, checkout and rebase will silently overwrite changes to such files. This is a regression introduced in commit 1dcafcc0 (verify_uptodate(): add ce_uptodate(ce) test), which avoids lstat's during a merge, if the index entry is up-to-date. If the CE_VALID flag is set, however, we cannot trust CE_UPTODATE. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2106-update-index-assume-unchanged.sh')
-rwxr-xr-xt/t2106-update-index-assume-unchanged.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t2106-update-index-assume-unchanged.sh b/t/t2106-update-index-assume-unchanged.sh
new file mode 100755
index 0000000000..99d858c6b7
--- /dev/null
+++ b/t/t2106-update-index-assume-unchanged.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+test_description='git update-index --assume-unchanged test.
+'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' \
+ ': >file &&
+ git add file &&
+ git commit -m initial &&
+ git branch other &&
+ echo upstream >file &&
+ git add file &&
+ git commit -m upstream'
+
+test_expect_success 'do not switch branches with dirty file' \
+ 'git reset --hard &&
+ git checkout other &&
+ echo dirt >file &&
+ git update-index --assume-unchanged file &&
+ test_must_fail git checkout master'
+
+test_done