From 6cb5728c43f34a7348e128b44b80d00b9417cb19 Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Wed, 3 Jul 2013 21:02:02 +1200 Subject: submodule update: allow custom command to update submodule working tree Users can set submodule.$name.update to '!command' which will cause 'command' to be run instead of checkout/merge/rebase. This allows the user finer-grained control over how the update is done. The primary motivation for this was interoperability with stgit; however being able to intercept the submodule update process may prove useful for integrating with or extending other tools. Signed-off-by: Chris Packham Signed-off-by: Junio C Hamano --- t/t7406-submodule-update.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 't') diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index cdb0538392..bc7cfcd835 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -294,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 && -- cgit v1.2.3