Merge branch 'jc/maint-t7406-rev-parse-max-count-huh'
authorJunio C Hamano <gitster@pobox.com>
Mon, 27 Aug 2012 18:54:36 +0000 (11:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Aug 2012 18:54:36 +0000 (11:54 -0700)
Test clean-up, with no behaviour change.

* jc/maint-t7406-rev-parse-max-count-huh:
t7406: fix misleading "rev-parse --max-count=1 HEAD"

1  2 
t/t7406-submodule-update.sh
index ce61d4c0fa3d916757e09224ed79bc191fb0cb3d,f4e6602c2dc13c14bc824b85708d2eead41c1be9..646298b2125fbbb7379ffb041099dc0d4bafaa55
@@@ -30,7 -30,6 +30,7 @@@ test_expect_success 'setup a submodule 
        git clone super submodule &&
        git clone super rebasing &&
        git clone super merging &&
 +      git clone super none &&
        (cd super &&
         git submodule add ../submodule submodule &&
         test_tick &&
         test_tick &&
         git commit -m "rebasing"
        )
 +      (cd super &&
 +       git submodule add ../none none &&
 +       test_tick &&
 +       git commit -m "none"
 +      )
  '
  
  test_expect_success 'submodule update detaching the HEAD ' '
@@@ -96,7 -90,7 +96,7 @@@ test_expect_success 'submodule update d
        (cd super &&
          git submodule update > ../actual 2> ../actual.err
        ) &&
 -      test_cmp expected actual &&
 +      test_i18ncmp expected actual &&
        ! test -s actual.err
  '
  
@@@ -304,62 -298,6 +304,62 @@@ test_expect_success 'submodule update i
        )
  '
  
 +test_expect_success 'submodule init picks up update=none' '
 +      (cd super &&
 +       git config -f .gitmodules submodule.none.update none &&
 +       git submodule init none &&
 +       test "none" = "$(git config submodule.none.update)"
 +      )
 +'
 +
 +test_expect_success 'submodule update - update=none in .git/config' '
 +      (cd super &&
 +       git config submodule.submodule.update none &&
 +       (cd submodule &&
 +        git checkout master &&
 +        compare_head
 +       ) &&
 +       git diff --raw | grep "        submodule" &&
 +       git submodule update &&
 +       git diff --raw | grep "        submodule" &&
 +       (cd submodule &&
 +        compare_head
 +       ) &&
 +       git config --unset submodule.submodule.update &&
 +       git submodule update submodule
 +      )
 +'
 +
 +test_expect_success 'submodule update - update=none in .git/config but --checkout given' '
 +      (cd super &&
 +       git config submodule.submodule.update none &&
 +       (cd submodule &&
 +        git checkout master &&
 +        compare_head
 +       ) &&
 +       git diff --raw | grep "        submodule" &&
 +       git submodule update --checkout &&
 +       test_must_fail git diff --raw \| grep "        submodule" &&
 +       (cd submodule &&
 +        test_must_fail compare_head
 +       ) &&
 +       git config --unset submodule.submodule.update
 +      )
 +'
 +
 +test_expect_success 'submodule update --init skips submodule with update=none' '
 +      (cd super &&
 +       git add .gitmodules &&
 +       git commit -m ".gitmodules"
 +      ) &&
 +      git clone super cloned &&
 +      (cd cloned &&
 +       git submodule update --init &&
 +       test -e submodule/.git &&
 +       test_must_fail test -e none/.git
 +      )
 +'
 +
  test_expect_success 'submodule update continues after checkout error' '
        (cd super &&
         git reset --hard HEAD &&
         git submodule init &&
         git commit -am "new_submodule" &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../expect
+         git rev-parse --verify HEAD >../expect
         ) &&
         (cd submodule &&
          test_commit "update_submodule" file
         git checkout HEAD^ &&
         test_must_fail git submodule update &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../actual
+         git rev-parse --verify HEAD >../actual
         ) &&
         test_cmp expect actual
        )
@@@ -413,7 -351,7 +413,7 @@@ test_expect_success 'submodule update c
          test_commit "update_submodule_again_again" file
         ) &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../expect &&
+         git rev-parse --verify HEAD >../expect &&
          test_commit "update_submodule2_again" file
         ) &&
         git add submodule &&
         ) &&
         test_must_fail git submodule update --recursive &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../actual
+         git rev-parse --verify HEAD >../actual
         ) &&
         test_cmp expect actual
        )
@@@ -460,17 -398,16 +460,17 @@@ test_expect_success 'submodule update e
         ) &&
         git checkout HEAD^ &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../expect
+         git rev-parse --verify HEAD >../expect
         ) &&
         git config submodule.submodule.update merge &&
         test_must_fail git submodule update &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../actual
+         git rev-parse --verify HEAD >../actual
         ) &&
         test_cmp expect actual
        )
  '
 +
  test_expect_success 'submodule update exit immediately after recursive rebase error' '
        (cd super &&
         git checkout master &&
         ) &&
         git checkout HEAD^ &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../expect
+         git rev-parse --verify HEAD >../expect
         ) &&
         git config submodule.submodule.update rebase &&
         test_must_fail git submodule update &&
         (cd submodule2 &&
-         git rev-parse --max-count=1 HEAD > ../actual
+         git rev-parse --verify HEAD >../actual
         ) &&
         test_cmp expect actual
        )
  '
 +
 +test_expect_success 'add different submodules to the same path' '
 +      (cd super &&
 +       git submodule add ../submodule s1 &&
 +       test_must_fail git submodule add ../merging s1
 +      )
 +'
 +
 +test_expect_success 'submodule add places git-dir in superprojects git-dir' '
 +      (cd super &&
 +       mkdir deeper &&
 +       git submodule add ../submodule deeper/submodule &&
 +       (cd deeper/submodule &&
 +        git log > ../../expected
 +       ) &&
 +       (cd .git/modules/deeper/submodule &&
 +        git log > ../../../../actual
 +       ) &&
 +       test_cmp actual expected
 +      )
 +'
 +
 +test_expect_success 'submodule update places git-dir in superprojects git-dir' '
 +      (cd super &&
 +       git commit -m "added submodule"
 +      ) &&
 +      git clone super super2 &&
 +      (cd super2 &&
 +       git submodule init deeper/submodule &&
 +       git submodule update &&
 +       (cd deeper/submodule &&
 +        git log > ../../expected
 +       ) &&
 +       (cd .git/modules/deeper/submodule &&
 +        git log > ../../../../actual
 +       ) &&
 +       test_cmp actual expected
 +      )
 +'
 +
 +test_expect_success 'submodule add places git-dir in superprojects git-dir recursive' '
 +      (cd super2 &&
 +       (cd deeper/submodule &&
 +        git submodule add ../submodule subsubmodule &&
 +        (cd subsubmodule &&
 +         git log > ../../../expected
 +        ) &&
 +        git commit -m "added subsubmodule" &&
 +        git push
 +       ) &&
 +       (cd .git/modules/deeper/submodule/modules/subsubmodule &&
 +        git log > ../../../../../actual
 +       ) &&
 +       git add deeper/submodule &&
 +       git commit -m "update submodule" &&
 +       git push &&
 +       test_cmp actual expected
 +      )
 +'
 +
 +test_expect_success 'submodule update places git-dir in superprojects git-dir recursive' '
 +      mkdir super_update_r &&
 +      (cd super_update_r &&
 +       git init --bare
 +      ) &&
 +      mkdir subsuper_update_r &&
 +      (cd subsuper_update_r &&
 +       git init --bare
 +      ) &&
 +      mkdir subsubsuper_update_r &&
 +      (cd subsubsuper_update_r &&
 +       git init --bare
 +      ) &&
 +      git clone subsubsuper_update_r subsubsuper_update_r2 &&
 +      (cd subsubsuper_update_r2 &&
 +       test_commit "update_subsubsuper" file &&
 +       git push origin master
 +      ) &&
 +      git clone subsuper_update_r subsuper_update_r2 &&
 +      (cd subsuper_update_r2 &&
 +       test_commit "update_subsuper" file &&
 +       git submodule add ../subsubsuper_update_r subsubmodule &&
 +       git commit -am "subsubmodule" &&
 +       git push origin master
 +      ) &&
 +      git clone super_update_r super_update_r2 &&
 +      (cd super_update_r2 &&
 +       test_commit "update_super" file &&
 +       git submodule add ../subsuper_update_r submodule &&
 +       git commit -am "submodule" &&
 +       git push origin master
 +      ) &&
 +      rm -rf super_update_r2 &&
 +      git clone super_update_r super_update_r2 &&
 +      (cd super_update_r2 &&
 +       git submodule update --init --recursive &&
 +       (cd submodule/subsubmodule &&
 +        git log > ../../expected
 +       ) &&
 +       (cd .git/modules/submodule/modules/subsubmodule
 +        git log > ../../../../../actual
 +       )
 +       test_cmp actual expected
 +      )
 +'
 +
 +test_expect_success 'submodule add properly re-creates deeper level submodules' '
 +      (cd super &&
 +       git reset --hard master &&
 +       rm -rf deeper/ &&
 +       git submodule add ../submodule deeper/submodule
 +      )
 +'
 +
 +test_expect_success 'submodule update properly revives a moved submodule' '
 +      (cd super &&
 +       git commit -am "pre move" &&
 +       git status >expect&&
 +       H=$(cd submodule2; git rev-parse HEAD) &&
 +       git rm --cached submodule2 &&
 +       rm -rf submodule2 &&
 +       mkdir -p "moved/sub module" &&
 +       git update-index --add --cacheinfo 160000 $H "moved/sub module" &&
 +       git config -f .gitmodules submodule.submodule2.path "moved/sub module"
 +       git commit -am "post move" &&
 +       git submodule update &&
 +       git status >actual &&
 +       test_cmp expect actual
 +      )
 +'
 +
 +test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd' '
 +      mkdir -p linked/dir &&
 +      ln -s linked/dir linkto &&
 +      (
 +              cd linkto &&
 +              git clone "$TRASH_DIRECTORY"/super_update_r2 super &&
 +              (
 +                      cd super &&
 +                      git submodule update --init --recursive
 +              )
 +      )
 +'
 +
  test_done