diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-07-31 18:57:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-07-31 18:57:32 -0700 |
commit | b35acb53458d0f99ba2400b902980b35e5acc2d3 (patch) | |
tree | 2e599a9af18af3b62ce52318b2759faa7d92f311 | |
parent | Merge branch 'maint' (diff) | |
parent | Break down no-lstat() condition checks in verify_uptodate() (diff) | |
download | tgif-b35acb53458d0f99ba2400b902980b35e5acc2d3.tar.xz |
Merge branch 'maint'
* maint:
Break down no-lstat() condition checks in verify_uptodate()
t7400: fix bogus test failure with symlinked trash
Documentation: clarify the invalidated tree entry format
-rw-r--r-- | Documentation/technical/index-format.txt | 5 | ||||
-rwxr-xr-x | t/t7400-submodule-basic.sh | 6 | ||||
-rw-r--r-- | unpack-trees.c | 15 |
3 files changed, 20 insertions, 6 deletions
diff --git a/Documentation/technical/index-format.txt b/Documentation/technical/index-format.txt index 7b233ca196..8930b3fabc 100644 --- a/Documentation/technical/index-format.txt +++ b/Documentation/technical/index-format.txt @@ -147,8 +147,9 @@ GIT index format - 160-bit object name for the object that would result from writing this span of index as a tree. - An entry can be in an invalidated state and is represented by having -1 - in the entry_count field. + An entry can be in an invalidated state and is represented by having + -1 in the entry_count field. In this case, there is no object name + and the next entry starts immediately after the newline. The entries are written out in the top-down, depth-first order. The first entry represents the root level of the repository, followed by the diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 5afe6ccd78..14dc92723c 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -47,8 +47,10 @@ test_expect_success 'setup - repository to add submodules to' ' ' # The 'submodule add' tests need some repository to add as a submodule. -# The trash directory is a good one as any. -submodurl=$TRASH_DIRECTORY +# The trash directory is a good one as any. We need to canonicalize +# the name, though, as some tests compare it to the absolute path git +# generates, which will expand symbolic links. +submodurl=$(pwd -P) listbranches() { git for-each-ref --format='%(refname)' 'refs/heads/*' diff --git a/unpack-trees.c b/unpack-trees.c index 3a61d821ee..cc616c3f99 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1168,11 +1168,22 @@ static int verify_uptodate_1(struct cache_entry *ce, { struct stat st; - if (o->index_only || (!((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) && (o->reset || ce_uptodate(ce)))) + if (o->index_only) + return 0; + + /* + * CE_VALID and CE_SKIP_WORKTREE cheat, we better check again + * if this entry is truly up-to-date because this file may be + * overwritten. + */ + if ((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) + ; /* keep checking */ + else if (o->reset || ce_uptodate(ce)) return 0; if (!lstat(ce->name, &st)) { - unsigned changed = ie_match_stat(o->src_index, ce, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE); + int flags = CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE; + unsigned changed = ie_match_stat(o->src_index, ce, &st, flags); if (!changed) return 0; /* |