3 test_description='push to a repository that borrows from elsewhere'
7 test_expect_success setup '
19 git commit -m initial &&
20 git push ../alice-pub master
23 # Project Bob is a fork of project Alice
28 mkdir -p objects/info &&
29 echo ../../alice-pub/objects >objects/info/alternates
31 git clone alice-pub bob-work &&
34 git push ../bob-pub master
38 test_expect_success 'alice works and pushes' '
42 git commit -a -m second &&
47 test_expect_success 'bob fetches from alice, works and pushes' '
49 # Bob acquires what Alice did in his work tree first.
50 # Even though these objects are not directly in
51 # the public repository of Bob, this push does not
52 # need to send the commit Bob received from Alice
53 # to his public repository, as all the object Alice
54 # has at her public repository are available to it
57 git pull ../alice-pub master &&
58 echo more bob >file &&
59 git commit -a -m third &&
63 # Check that the second commit by Alice is not sent
67 second=$(git rev-parse HEAD^) &&
68 rm -f objects/info/alternates &&
69 test_must_fail git cat-file -t $second &&
70 echo ../../alice-pub/objects >objects/info/alternates
74 test_expect_success 'clean-up in case the previous failed' '
77 echo ../../alice-pub/objects >objects/info/alternates
81 test_expect_success 'alice works and pushes again' '
83 # Alice does not care what Bob does. She does not
84 # even have to be aware of his existence. She just
85 # keeps working and pushing
87 echo more alice >file &&
88 git commit -a -m fourth &&
93 test_expect_success 'bob works and pushes' '
95 # This time Bob does not pull from Alice, and
96 # the master branch at her public repository points
97 # at a commit Bob does not know about. This should
98 # not prevent the push by Bob from succeeding.
100 echo yet more bob >file &&
101 git commit -a -m fifth &&