Makefile: clean up http-walker.o dependency rules
[git/gsoc2010-gitweb.git] / t / t3414-rebase-preserve-onto.sh
blobee0a6cccfda832c62233d358f4933e9cd3ab2c8d
1 #!/bin/sh
3 # Copyright (c) 2009 Greg Price
6 test_description='git rebase -p should respect --onto
8 In a rebase with --onto, we should rewrite all the commits that
9 aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM.
11 . ./test-lib.sh
13 . "$TEST_DIRECTORY"/lib-rebase.sh
15 # Set up branches like this:
16 # A1---B1---E1---F1---G1
17 # \ \ /
18 # \ \--C1---D1--/
19 # H1
21 test_expect_success 'setup' '
22 test_commit A1 &&
23 test_commit B1 &&
24 test_commit C1 &&
25 test_commit D1 &&
26 git reset --hard B1 &&
27 test_commit E1 &&
28 test_commit F1 &&
29 test_merge G1 D1 &&
30 git reset --hard A1 &&
31 test_commit H1
34 # Now rebase merge G1 from both branches' base B1, both should move:
35 # A1---B1---E1---F1---G1
36 # \ \ /
37 # \ \--C1---D1--/
38 # \
39 # H1---E2---F2---G2
40 # \ /
41 # \--C2---D2--/
43 test_expect_success 'rebase from B1 onto H1' '
44 git checkout G1 &&
45 git rebase -p --onto H1 B1 &&
46 test "$(git rev-parse HEAD^1^1^1)" = "$(git rev-parse H1)" &&
47 test "$(git rev-parse HEAD^2^1^1)" = "$(git rev-parse H1)"
50 # On the other hand if rebase from E1 which is within one branch,
51 # then the other branch stays:
52 # A1---B1---E1---F1---G1
53 # \ \ /
54 # \ \--C1---D1--/
55 # \ \
56 # H1-----F3-----G3
58 test_expect_success 'rebase from E1 onto H1' '
59 git checkout G1 &&
60 git rebase -p --onto H1 E1 &&
61 test "$(git rev-parse HEAD^1^1)" = "$(git rev-parse H1)" &&
62 test "$(git rev-parse HEAD^2)" = "$(git rev-parse D1)"
65 # And the same if we rebase from a commit in the second-parent branch.
66 # A1---B1---E1---F1----G1
67 # \ \ \ /
68 # \ \--C1---D1-\-/
69 # \ \
70 # H1------D3------G4
72 test_expect_success 'rebase from C1 onto H1' '
73 git checkout G1 &&
74 git rev-list --first-parent --pretty=oneline C1..G1 &&
75 git rebase -p --onto H1 C1 &&
76 test "$(git rev-parse HEAD^2^1)" = "$(git rev-parse H1)" &&
77 test "$(git rev-parse HEAD^1)" = "$(git rev-parse F1)"
80 test_done