Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2011 01:57:32 +0000 (18:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2011 01:57:32 +0000 (18:57 -0700)
* 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

1  2 
t/t7400-submodule-basic.sh
unpack-trees.c
index 5afe6ccd78f7171c6bdbb5be35d9663a618c1c73,3f115d9ca966879ccd7d587911d7d54bc88c08c2..14dc92723c3dc96c1c3c15724df668226edf578e
@@@ -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 3a61d821ee85a9cfb026909c6ae90def360a7681,e22b9ec408db64a5fa05328dfc06bdc99bdbce4d..cc616c3f991a655d10fcac15055fcdfafa8620fd
@@@ -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;
                /*