mirror of
https://github.com/git/git
synced 2024-09-12 21:04:12 +00:00
submodule tests: test for init and update failure output
Amend some submodule tests to test for the failure output of "git submodule [update|init]". The lack of such tests hid a regression in an earlier version of a subsequent commit. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
715d08a9e5
commit
aca8568e2c
|
@ -205,8 +205,18 @@ test_expect_success 'submodule update should fail due to local changes' '
|
||||||
(cd submodule &&
|
(cd submodule &&
|
||||||
compare_head
|
compare_head
|
||||||
) &&
|
) &&
|
||||||
test_must_fail git submodule update submodule
|
test_must_fail git submodule update submodule 2>../actual.raw
|
||||||
)
|
) &&
|
||||||
|
sed "s/^> //" >expect <<-\EOF &&
|
||||||
|
> error: Your local changes to the following files would be overwritten by checkout:
|
||||||
|
> file
|
||||||
|
> Please commit your changes or stash them before you switch branches.
|
||||||
|
> Aborting
|
||||||
|
> fatal: Unable to checkout OID in submodule path '\''submodule'\''
|
||||||
|
EOF
|
||||||
|
sed -e "s/checkout $SQ[^$SQ]*$SQ/checkout OID/" <actual.raw >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
|
||||||
'
|
'
|
||||||
test_expect_success 'submodule update should throw away changes with --force ' '
|
test_expect_success 'submodule update should throw away changes with --force ' '
|
||||||
(cd super &&
|
(cd super &&
|
||||||
|
|
|
@ -193,7 +193,19 @@ test_expect_success 'missing nested submodule alternate fails clone and submodul
|
||||||
cd supersuper-clone &&
|
cd supersuper-clone &&
|
||||||
check_that_two_of_three_alternates_are_used &&
|
check_that_two_of_three_alternates_are_used &&
|
||||||
# update of the submodule fails
|
# update of the submodule fails
|
||||||
test_must_fail git submodule update --init --recursive
|
cat >expect <<-\EOF &&
|
||||||
|
fatal: submodule '\''sub'\'' cannot add alternate: path ... does not exist
|
||||||
|
Failed to clone '\''sub'\''. Retry scheduled
|
||||||
|
fatal: submodule '\''sub-dissociate'\'' cannot add alternate: path ... does not exist
|
||||||
|
Failed to clone '\''sub-dissociate'\''. Retry scheduled
|
||||||
|
fatal: submodule '\''sub'\'' cannot add alternate: path ... does not exist
|
||||||
|
Failed to clone '\''sub'\'' a second time, aborting
|
||||||
|
fatal: Failed to recurse into submodule path ...
|
||||||
|
EOF
|
||||||
|
test_must_fail git submodule update --init --recursive 2>err &&
|
||||||
|
grep -e fatal: -e ^Failed err >actual.raw &&
|
||||||
|
sed -e "s/path $SQ[^$SQ]*$SQ/path .../" <actual.raw >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue