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
This commit is contained in:
commit
b35acb5345
@ -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
|
||||
|
@ -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/*'
|
||||
|
@ -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;
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user