blob: c13120088fa684b59cc2f598d8ebfe05cae7b42c [file] [log] [blame]
Dmitry V. Levinefb98b42008-05-28 19:29:36 +04001#!/bin/sh
2#
3# Copyright (c) 2008 Dmitry V. Levin
4#
5
6test_description='fetch exit status test'
7
Johannes Schindelinbc925ce2020-11-18 23:44:32 +00008GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
Johannes Schindelin334afbc2020-11-18 23:44:19 +00009export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10
Ævar Arnfjörð Bjarmason7a98d9a2022-04-13 22:01:47 +020011TEST_PASSES_SANITIZE_LEAK=true
Dmitry V. Levinefb98b42008-05-28 19:29:36 +040012. ./test-lib.sh
13
14test_expect_success setup '
15
16 >file &&
17 git add file &&
18 git commit -m initial &&
19
20 git checkout -b side &&
21 echo side >file &&
22 git commit -a -m side &&
23
Johannes Schindelinbc925ce2020-11-18 23:44:32 +000024 git checkout main &&
Dmitry V. Levinefb98b42008-05-28 19:29:36 +040025 echo next >file &&
26 git commit -a -m next
27'
28
Felipe Contrerasa75d7b52009-10-24 11:31:32 +030029test_expect_success 'non-fast-forward fetch' '
Dmitry V. Levinefb98b42008-05-28 19:29:36 +040030
Johannes Schindelinbc925ce2020-11-18 23:44:32 +000031 test_must_fail git fetch . main:side
Dmitry V. Levinefb98b42008-05-28 19:29:36 +040032
33'
34
35test_expect_success 'forced update' '
36
Johannes Schindelinbc925ce2020-11-18 23:44:32 +000037 git fetch . +main:side
Dmitry V. Levinefb98b42008-05-28 19:29:36 +040038
39'
40
41test_done