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
maint
Junio C Hamano 2011-07-31 18:57:32 -07:00
commit b35acb5345
3 changed files with 20 additions and 6 deletions

View File

@ -147,8 +147,9 @@ GIT index format
- 160-bit object name for the object that would result from writing - 160-bit object name for the object that would result from writing
this span of index as a tree. this span of index as a tree.


An entry can be in an invalidated state and is represented by having -1 An entry can be in an invalidated state and is represented by having
in the entry_count field. -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 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 first entry represents the root level of the repository, followed by the

View File

@ -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 'submodule add' tests need some repository to add as a submodule.
# The trash directory is a good one as any. # The trash directory is a good one as any. We need to canonicalize
submodurl=$TRASH_DIRECTORY # the name, though, as some tests compare it to the absolute path git
# generates, which will expand symbolic links.
submodurl=$(pwd -P)


listbranches() { listbranches() {
git for-each-ref --format='%(refname)' 'refs/heads/*' git for-each-ref --format='%(refname)' 'refs/heads/*'

View File

@ -1168,11 +1168,22 @@ static int verify_uptodate_1(struct cache_entry *ce,
{ {
struct stat st; 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; return 0;


if (!lstat(ce->name, &st)) { 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) if (!changed)
return 0; return 0;
/* /*