From: Junio C Hamano Date: Mon, 1 Aug 2011 01:57:32 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.7.7-rc0~68 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b35acb53458d0f99ba2400b902980b35e5acc2d3?hp=-c 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 --- b35acb53458d0f99ba2400b902980b35e5acc2d3 diff --combined t/t7400-submodule-basic.sh index 5afe6ccd78,3f115d9ca9..14dc92723c --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@@ -47,8 -47,10 +47,10 @@@ test_expect_success 'setup - repositor ' # 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/*' @@@ -99,7 -101,7 +101,7 @@@ test_expect_success 'submodule add to . git add --force .gitignore && git commit -m"Ignore everything" && ! git submodule add "$submodurl" submod >actual 2>&1 && - test_cmp expect actual + test_i18ncmp expect actual ) ' @@@ -357,7 -359,7 +359,7 @@@ test_expect_success 'update --init' git submodule update init > update.out && cat update.out && - grep "not initialized" update.out && + test_i18ngrep "not initialized" update.out && ! test -d init/.git && git submodule update --init init && @@@ -446,16 -448,6 +448,16 @@@ test_expect_success 'add should fail wh ) ' +test_expect_success 'use superproject as upstream when path is relative and no url is set there' ' + ( + cd addtest && + git submodule add ../repo relative && + test "$(git config -f .gitmodules submodule.relative.url)" = ../repo && + git submodule sync relative && + test "$(git config submodule.relative.url)" = "$submodurl/repo" + ) +' + test_expect_success 'set up for relative path tests' ' mkdir reltest && ( diff --combined unpack-trees.c index 3a61d821ee,e22b9ec408..cc616c3f99 --- a/unpack-trees.c +++ b/unpack-trees.c @@@ -593,7 -593,7 +593,7 @@@ static int unpack_nondirectories(int n static int unpack_failed(struct unpack_trees_options *o, const char *message) { discard_index(&o->result); - if (!o->gently) { + if (!o->gently && !o->exiting_early) { if (message) return error("%s", message); return -1; @@@ -1133,8 -1133,6 +1133,8 @@@ return_failed display_error_msgs(o); mark_all_ce_unused(o->src_index); ret = unpack_failed(o, NULL); + if (o->exiting_early) + ret = 0; goto done; } @@@ -1168,11 -1166,22 +1168,22 @@@ static int verify_uptodate_1(struct cac { 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; /*