mirror of
https://github.com/git/git.git
synced 2024-11-25 02:44:48 +08:00
2d59ced104
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
74 lines
1.7 KiB
Bash
Executable File
74 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='push with --set-upstream'
|
|
. ./test-lib.sh
|
|
|
|
ensure_fresh_upstream() {
|
|
rm -rf parent && git init --bare parent
|
|
}
|
|
|
|
test_expect_success 'setup bare parent' '
|
|
ensure_fresh_upstream &&
|
|
git remote add upstream parent
|
|
'
|
|
|
|
test_expect_success 'setup local commit' '
|
|
echo content >file &&
|
|
git add file &&
|
|
git commit -m one
|
|
'
|
|
|
|
check_config() {
|
|
(echo $2; echo $3) >expect.$1
|
|
(git config branch.$1.remote
|
|
git config branch.$1.merge) >actual.$1
|
|
test_cmp expect.$1 actual.$1
|
|
}
|
|
|
|
test_expect_success 'push -u master:master' '
|
|
git push -u upstream master:master &&
|
|
check_config master upstream refs/heads/master
|
|
'
|
|
|
|
test_expect_success 'push -u master:other' '
|
|
git push -u upstream master:other &&
|
|
check_config master upstream refs/heads/other
|
|
'
|
|
|
|
test_expect_success 'push -u --dry-run master:otherX' '
|
|
git push -u --dry-run upstream master:otherX &&
|
|
check_config master upstream refs/heads/other
|
|
'
|
|
|
|
test_expect_success 'push -u master2:master2' '
|
|
git branch master2 &&
|
|
git push -u upstream master2:master2 &&
|
|
check_config master2 upstream refs/heads/master2
|
|
'
|
|
|
|
test_expect_success 'push -u master2:other2' '
|
|
git push -u upstream master2:other2 &&
|
|
check_config master2 upstream refs/heads/other2
|
|
'
|
|
|
|
test_expect_success 'push -u :master2' '
|
|
git push -u upstream :master2 &&
|
|
check_config master2 upstream refs/heads/other2
|
|
'
|
|
|
|
test_expect_success 'push -u --all' '
|
|
git branch all1 &&
|
|
git branch all2 &&
|
|
git push -u --all &&
|
|
check_config all1 upstream refs/heads/all1 &&
|
|
check_config all2 upstream refs/heads/all2
|
|
'
|
|
|
|
test_expect_success 'push -u HEAD' '
|
|
git checkout -b headbranch &&
|
|
git push -u upstream HEAD &&
|
|
check_config headbranch upstream refs/heads/headbranch
|
|
'
|
|
|
|
test_done
|