interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t5405-send-pack-rewind.sh

45 lines · 732 bytes Raw Blame History
1#!/bin/sh
2
3test_description='forced push to replace commit we do not have'
4
5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8. ./test-lib.sh
9
10test_expect_success setup '
11
12 >file1 && git add file1 && test_tick &&
13 git commit -m Initial &&
14 git config receive.denyCurrentBranch warn &&
15
16 mkdir another && (
17 cd another &&
18 git init &&
19 git fetch --update-head-ok .. main:main
20 ) &&
21
22 >file2 && git add file2 && test_tick &&
23 git commit -m Second
24
25'
26
27test_expect_success 'non forced push should die not segfault' '
28
29 (
30 cd another &&
31 test_must_fail git push .. main:main
32 )
33
34'
35
36test_expect_success 'forced push should succeed' '
37
38 (
39 cd another &&
40 git push .. +main:main
41 )
42
43'
44
45test_done