Merge branch 'cb/assume-unchanged-fix'
* cb/assume-unchanged-fix: Documentation: git-add does not update files marked "assume unchanged" do not overwrite files marked "assume unchanged"
This commit is contained in:
commit
40e9b27dec
@ -93,8 +93,6 @@ OPTIONS
|
|||||||
This option can be also used as a coarse file-level mechanism
|
This option can be also used as a coarse file-level mechanism
|
||||||
to ignore uncommitted changes in tracked files (akin to what
|
to ignore uncommitted changes in tracked files (akin to what
|
||||||
`.gitignore` does for untracked files).
|
`.gitignore` does for untracked files).
|
||||||
You should remember that an explicit 'git add' operation will
|
|
||||||
still cause the file to be refreshed from the working tree.
|
|
||||||
Git will fail (gracefully) in case it needs to modify this file
|
Git will fail (gracefully) in case it needs to modify this file
|
||||||
in the index e.g. when merging in a commit;
|
in the index e.g. when merging in a commit;
|
||||||
thus, in case the assumed-untracked file is changed upstream,
|
thus, in case the assumed-untracked file is changed upstream,
|
||||||
|
24
t/t2106-update-index-assume-unchanged.sh
Executable file
24
t/t2106-update-index-assume-unchanged.sh
Executable file
@ -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
|
@ -854,7 +854,7 @@ static int verify_uptodate_1(struct cache_entry *ce,
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (o->index_only || (!ce_skip_worktree(ce) && (o->reset || ce_uptodate(ce))))
|
if (o->index_only || (!((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) && (o->reset || ce_uptodate(ce))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!lstat(ce->name, &st)) {
|
if (!lstat(ce->name, &st)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user