summaryrefslogtreecommitdiff
path: root/t/t6040-tracking-info.sh
diff options
context:
space:
mode:
authorKaartic Sivaraam <kaarticsivaraam91196@gmail.com>2017-08-17 02:54:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-17 20:33:20 (GMT)
commit52668846ea2d41ffbd87cda7cb8e492dea9f2c4d (patch)
treed56d2e72aa8c2a781854a7e8be7f8b8660254d36 /t/t6040-tracking-info.sh
parent93a6b3f234555006448bfbbaf5ecc3ea19faaa16 (diff)
downloadgit-52668846ea2d41ffbd87cda7cb8e492dea9f2c4d.zip
git-52668846ea2d41ffbd87cda7cb8e492dea9f2c4d.tar.gz
git-52668846ea2d41ffbd87cda7cb8e492dea9f2c4d.tar.bz2
builtin/branch: stop supporting the "--set-upstream" option
The '--set-upstream' option of branch was deprecated in b347d06b ("branch: deprecate --set-upstream and show help if we detect possible mistaken use", 2012-08-30) and has been planned for removal ever since. In order to prevent "--set-upstream" on a command line from being taken as an abbreviated form of "--set-upstream-to", explicitly catch "--set-upstream" option and die, instead of just removing it from the list of options. Before this change, an attempt to use "--set-upstream" resulted in: $ git branch * master $ git branch --set-upstream origin/master The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to Branch origin/master set up to track local branch master. $ echo $? 0 $ git branch * master origin/master With this change, the behaviour becomes like this: $ git branch * master $ git branch --set-upstream origin/master fatal: the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead. $ echo $? 128 $ git branch * master Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6040-tracking-info.sh')
-rwxr-xr-xt/t6040-tracking-info.sh20
1 files changed, 7 insertions, 13 deletions
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index 97a0765..be78cc4 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -188,35 +188,29 @@ test_expect_success 'fail to track annotated tags' '
test_must_fail git checkout heavytrack
'
-test_expect_success 'setup tracking with branch --set-upstream on existing branch' '
+test_expect_success '--set-upstream-to does not change branch' '
git branch from-master master &&
- test_must_fail git config branch.from-master.merge > actual &&
- git branch --set-upstream from-master master &&
- git config branch.from-master.merge > actual &&
- grep -q "^refs/heads/master$" actual
-'
-
-test_expect_success '--set-upstream does not change branch' '
+ git branch --set-upstream-to master from-master &&
git branch from-master2 master &&
test_must_fail git config branch.from-master2.merge > actual &&
git rev-list from-master2 &&
git update-ref refs/heads/from-master2 from-master2^ &&
git rev-parse from-master2 >expect2 &&
- git branch --set-upstream from-master2 master &&
+ git branch --set-upstream-to master from-master2 &&
git config branch.from-master.merge > actual &&
git rev-parse from-master2 >actual2 &&
grep -q "^refs/heads/master$" actual &&
cmp expect2 actual2
'
-test_expect_success '--set-upstream @{-1}' '
- git checkout from-master &&
+test_expect_success '--set-upstream-to @{-1}' '
+ git checkout follower &&
git checkout from-master2 &&
git config branch.from-master2.merge > expect2 &&
- git branch --set-upstream @{-1} follower &&
+ git branch --set-upstream-to @{-1} from-master &&
git config branch.from-master.merge > actual &&
git config branch.from-master2.merge > actual2 &&
- git branch --set-upstream from-master follower &&
+ git branch --set-upstream-to follower from-master &&
git config branch.from-master.merge > expect &&
test_cmp expect2 actual2 &&
test_cmp expect actual