From b81842cbbba21a400c9c7a78c5b358565936254a Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 22 Feb 2016 12:23:24 +0100 Subject: branch: die on config error when unsetting upstream When we try to unset upstream configurations we do not check return codes for the `git_config_set` functions. As those may indicate that we were unable to unset the respective configuration we may exit successfully without any error message while in fact the upstream configuration was not unset. Fix this by dying with an error message when we cannot unset the configuration. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index dd776b355..a89724849 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -473,6 +473,13 @@ test_expect_success '--unset-upstream should fail if given a non-existent branch test_must_fail git branch --unset-upstream i-dont-exist ' +test_expect_success '--unset-upstream should fail if config is locked' ' + test_when_finished "rm -f .git/config.lock" && + git branch --set-upstream-to locked && + >.git/config.lock && + test_must_fail git branch --unset-upstream +' + test_expect_success 'test --unset-upstream on HEAD' ' git branch my14 && test_config branch.master.remote foo && -- cgit v1.2.1