Merge branch 'rr/send-email-ssl-verify'
[gitweb.git] / t / t7406-submodule-update.sh
index a4ffea0dbe743a1bbe4c5512037a6b1ffde1c313..b192f936bcbe794f0691550d1bf38714b1359d01 100755 (executable)
@@ -80,6 +80,21 @@ test_expect_success 'submodule update detaching the HEAD ' '
        )
 '
 
+test_expect_success 'submodule update from subdirectory' '
+       (cd super/submodule &&
+        git reset --hard HEAD~1
+       ) &&
+       mkdir super/sub &&
+       (cd super/sub &&
+        (cd ../submodule &&
+         compare_head
+        ) &&
+        git submodule update ../submodule &&
+        cd ../submodule &&
+        ! compare_head
+       )
+'
+
 apos="'";
 test_expect_success 'submodule update does not fetch already present commits' '
        (cd submodule &&
@@ -279,6 +294,35 @@ test_expect_success 'submodule update - checkout in .git/config' '
        )
 '
 
+test_expect_success 'submodule update - command in .git/config' '
+       (cd super &&
+        git config submodule.submodule.update "!git checkout"
+       ) &&
+       (cd super/submodule &&
+         git reset --hard HEAD^
+       ) &&
+       (cd super &&
+        (cd submodule &&
+         compare_head
+        ) &&
+        git submodule update submodule &&
+        cd submodule &&
+        ! compare_head
+       )
+'
+
+test_expect_success 'submodule update - command in .git/config catches failure' '
+       (cd super &&
+        git config submodule.submodule.update "!false"
+       ) &&
+       (cd super/submodule &&
+         git reset --hard HEAD^
+       ) &&
+       (cd super &&
+        test_must_fail git submodule update submodule
+       )
+'
+
 test_expect_success 'submodule init picks up rebase' '
        (cd super &&
         git config -f .gitmodules submodule.rebasing.update rebase &&
@@ -685,14 +729,24 @@ test_expect_success 'submodule update properly revives a moved submodule' '
 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
-               )
+       (cd linkto &&
+        git clone "$TRASH_DIRECTORY"/super_update_r2 super &&
+        (cd super &&
+         git submodule update --init --recursive
+        )
        )
 '
 
+test_expect_success 'submodule update clone shallow submodule' '
+       git clone cloned super3 &&
+       pwd=$(pwd)
+       (cd super3 &&
+        sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
+        mv -f .gitmodules.tmp .gitmodules &&
+        git submodule update --init --depth=3
+        (cd submodule &&
+         test 1 = $(git log --oneline | wc -l)
+        )
+       )
+'
 test_done