summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-01-05 23:42:11 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-01-05 23:42:11 -0800
commit902f2f4f0a0bcc6c8d63ad4cd6b75b7eb9d65a72 (patch)
treed47607e6111ba79292a3e5dcc69603139d7e0623 /t
parentMerge branch 'jk/pathspec-literal' (diff)
parentsubmodule add: If --branch is given, record it in .gitmodules (diff)
downloadtgif-902f2f4f0a0bcc6c8d63ad4cd6b75b7eb9d65a72.tar.xz
Merge branch 'wk/submodule-update-remote'
The beginning of 'integrate with the tip of the remote branch, not the commit recorded in the superproject gitlink' support. * wk/submodule-update-remote: submodule add: If --branch is given, record it in .gitmodules submodule update: add --remote for submodule's upstream changes submodule: add get_submodule_config helper funtion
Diffstat (limited to 't')
-rwxr-xr-xt/t7400-submodule-basic.sh1
-rwxr-xr-xt/t7406-submodule-update.sh31
2 files changed, 32 insertions, 0 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index de7d45352e..2683cba7e3 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -133,6 +133,7 @@ test_expect_success 'submodule add --branch' '
(
cd addtest &&
git submodule add -b initial "$submodurl" submod-branch &&
+ test "initial" = "$(git config -f .gitmodules submodule.submod-branch.branch)" &&
git submodule init
) &&
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index feaec6cdf4..4975ec07ce 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -135,6 +135,37 @@ test_expect_success 'submodule update --force forcibly checks out submodules' '
)
'
+test_expect_success 'submodule update --remote should fetch upstream changes' '
+ (cd submodule &&
+ echo line4 >> file &&
+ git add file &&
+ test_tick &&
+ git commit -m "upstream line4"
+ ) &&
+ (cd super &&
+ git submodule update --remote --force submodule &&
+ cd submodule &&
+ test "$(git log -1 --oneline)" = "$(GIT_DIR=../../submodule/.git git log -1 --oneline)"
+ )
+'
+
+test_expect_success 'local config should override .gitmodules branch' '
+ (cd submodule &&
+ git checkout -b test-branch &&
+ echo line5 >> file &&
+ git add file &&
+ test_tick &&
+ git commit -m "upstream line5" &&
+ git checkout master
+ ) &&
+ (cd super &&
+ git config submodule.submodule.branch test-branch &&
+ git submodule update --remote --force submodule &&
+ cd submodule &&
+ test "$(git log -1 --oneline)" = "$(GIT_DIR=../../submodule/.git git log -1 --oneline test-branch)"
+ )
+'
+
test_expect_success 'submodule update --rebase staying on master' '
(cd super/submodule &&
git checkout master