]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t7406-submodule-update.sh
Merge branch 'jn/gitweb-patch'
[git.git] / t / t7406-submodule-update.sh
index 3442c05d2a535dcd4ae7a6784db7ed268695191c..2d33d9efec3f2f601305e736e31368621acd0584 100755 (executable)
@@ -6,7 +6,7 @@
 test_description='Test updating submodules
 
 This test verifies that "git submodule update" detaches the HEAD of the
-submodule and "git submodule update --rebase" does not detach the HEAD.
+submodule and "git submodule update --rebase/--merge" does not detach the HEAD.
 '
 
 . ./test-lib.sh
@@ -76,9 +76,23 @@ test_expect_success 'submodule update --rebase staying on master' '
        )
 '
 
-test_expect_success 'submodule update - rebase true in .git/config' '
+test_expect_success 'submodule update --merge staying on master' '
+       (cd super/submodule &&
+         git reset --hard HEAD~1
+       ) &&
+       (cd super &&
+        (cd submodule &&
+         compare_head
+        ) &&
+        git submodule update --merge submodule &&
+        cd submodule &&
+        compare_head
+       )
+'
+
+test_expect_success 'submodule update - rebase in .git/config' '
        (cd super &&
-        git config submodule.submodule.rebase true
+        git config submodule.submodule.update rebase
        ) &&
        (cd super/submodule &&
          git reset --hard HEAD~1
@@ -93,9 +107,9 @@ test_expect_success 'submodule update - rebase true in .git/config' '
        )
 '
 
-test_expect_success 'submodule update - rebase false in .git/config but --rebase given' '
+test_expect_success 'submodule update - checkout in .git/config but --rebase given' '
        (cd super &&
-        git config submodule.submodule.rebase false
+        git config submodule.submodule.update checkout
        ) &&
        (cd super/submodule &&
          git reset --hard HEAD~1
@@ -110,9 +124,43 @@ test_expect_success 'submodule update - rebase false in .git/config but --rebase
        )
 '
 
-test_expect_success 'submodule update - rebase false in .git/config' '
+test_expect_success 'submodule update - merge in .git/config' '
        (cd super &&
-        git config submodule.submodule.rebase false
+        git config submodule.submodule.update merge
+       ) &&
+       (cd super/submodule &&
+         git reset --hard HEAD~1
+       ) &&
+       (cd super &&
+        (cd submodule &&
+         compare_head
+        ) &&
+        git submodule update submodule &&
+        cd submodule &&
+        compare_head
+       )
+'
+
+test_expect_success 'submodule update - checkout in .git/config but --merge given' '
+       (cd super &&
+        git config submodule.submodule.update checkout
+       ) &&
+       (cd super/submodule &&
+         git reset --hard HEAD~1
+       ) &&
+       (cd super &&
+        (cd submodule &&
+         compare_head
+        ) &&
+        git submodule update --merge submodule &&
+        cd submodule &&
+        compare_head
+       )
+'
+
+test_expect_success 'submodule update - checkout in .git/config' '
+       (cd super &&
+        git config submodule.submodule.update checkout
        ) &&
        (cd super/submodule &&
          git reset --hard HEAD^
@@ -131,9 +179,19 @@ test_expect_success 'submodule init picks up rebase' '
        (cd super &&
         git config submodule.rebasing.url git://non-existing/git &&
         git config submodule.rebasing.path does-not-matter &&
-        git config submodule.rebasing.rebase true &&
+        git config submodule.rebasing.update rebase &&
         git submodule init rebasing &&
-        test true = $(git config --bool submodule.rebasing.rebase)
+        test "rebase" = $(git config submodule.rebasing.update)
+       )
+'
+
+test_expect_success 'submodule init picks up merge' '
+       (cd super &&
+        git config submodule.merging.url git://non-existing/git &&
+        git config submodule.merging.path does-not-matter &&
+        git config submodule.merging.update merge &&
+        git submodule init merging &&
+        test "merge" = $(git config submodule.merging.update)
        )
 '