git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
fdbd095cde3a3a446f481ea1cdce7fccafcf1907 blob 4916 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
 
#!/bin/sh

test_description='"git merge" top-level frontend'

. ./test-lib.sh

t3033_reset () {
	git checkout -B main two &&
	git branch -f left three &&
	git branch -f right four
}

test_expect_success setup '
	test_commit one &&
	git branch left &&
	git branch right &&
	test_commit two &&
	git checkout left &&
	test_commit three &&
	git checkout right &&
	test_commit four &&
	git checkout --orphan newroot &&
	test_commit five &&
	git checkout main
'

# Local branches

test_expect_success 'merge an octopus into void' '
	t3033_reset &&
	git checkout --orphan test &&
	git rm -fr . &&
	test_must_fail git merge left right &&
	test_must_fail git rev-parse --verify HEAD &&
	git diff --quiet &&
	test_must_fail git rev-parse HEAD
'

test_expect_success 'merge an octopus, fast-forward (ff)' '
	t3033_reset &&
	git reset --hard one &&
	git merge left right &&
	# one is ancestor of three (left) and four (right)
	test_must_fail git rev-parse --verify HEAD^3 &&
	git rev-parse HEAD^1 HEAD^2 | sort >actual &&
	git rev-parse three four | sort >expect &&
	test_cmp expect actual
'

test_expect_success 'merge octopus, non-fast-forward (ff)' '
	t3033_reset &&
	git reset --hard one &&
	git merge --no-ff left right &&
	# one is ancestor of three (left) and four (right)
	test_must_fail git rev-parse --verify HEAD^4 &&
	git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
	git rev-parse one three four | sort >expect &&
	test_cmp expect actual
'

test_expect_success 'merge octopus, fast-forward (does not ff)' '
	t3033_reset &&
	git merge left right &&
	# two (main) is not an ancestor of three (left) and four (right)
	test_must_fail git rev-parse --verify HEAD^4 &&
	git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
	git rev-parse two three four | sort >expect &&
	test_cmp expect actual
'

test_expect_success 'merge octopus, non-fast-forward' '
	t3033_reset &&
	git merge --no-ff left right &&
	test_must_fail git rev-parse --verify HEAD^4 &&
	git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
	git rev-parse two three four | sort >expect &&
	test_cmp expect actual
'

# The same set with FETCH_HEAD

test_expect_success 'merge FETCH_HEAD octopus into void' '
	t3033_reset &&
	git checkout --orphan test &&
	git rm -fr . &&
	git fetch . left right &&
	test_must_fail git merge FETCH_HEAD &&
	test_must_fail git rev-parse --verify HEAD &&
	git diff --quiet &&
	test_must_fail git rev-parse HEAD
'

test_expect_success 'merge FETCH_HEAD octopus fast-forward (ff)' '
	t3033_reset &&
	git reset --hard one &&
	git fetch . left right &&
	git merge FETCH_HEAD &&
	# one is ancestor of three (left) and four (right)
	test_must_fail git rev-parse --verify HEAD^3 &&
	git rev-parse HEAD^1 HEAD^2 | sort >actual &&
	git rev-parse three four | sort >expect &&
	test_cmp expect actual
'

test_expect_success 'merge FETCH_HEAD octopus non-fast-forward (ff)' '
	t3033_reset &&
	git reset --hard one &&
	git fetch . left right &&
	git merge --no-ff FETCH_HEAD &&
	# one is ancestor of three (left) and four (right)
	test_must_fail git rev-parse --verify HEAD^4 &&
	git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
	git rev-parse one three four | sort >expect &&
	test_cmp expect actual
'

test_expect_success 'merge FETCH_HEAD octopus fast-forward (does not ff)' '
	t3033_reset &&
	git fetch . left right &&
	git merge FETCH_HEAD &&
	# two (main) is not an ancestor of three (left) and four (right)
	test_must_fail git rev-parse --verify HEAD^4 &&
	git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
	git rev-parse two three four | sort >expect &&
	test_cmp expect actual
'

test_expect_success 'merge FETCH_HEAD octopus non-fast-forward' '
	t3033_reset &&
	git fetch . left right &&
	git merge --no-ff FETCH_HEAD &&
	test_must_fail git rev-parse --verify HEAD^4 &&
	git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
	git rev-parse two three four | sort >expect &&
	test_cmp expect actual
'

# two-project merge
test_expect_success 'refuse two-project merge by default' '
	t3033_reset &&
	git reset --hard four &&
	test_must_fail git merge five
'

test_expect_success 'refuse two-project merge by default, quit before --autostash happens' '
	t3033_reset &&
	git reset --hard four &&
	echo change >>one.t &&
	git diff >expect &&
	test_must_fail git merge --autostash five 2>err &&
	test_i18ngrep ! "stash" err &&
	git diff >actual &&
	test_cmp expect actual
'

test_expect_success 'two-project merge with --allow-unrelated-histories' '
	t3033_reset &&
	git reset --hard four &&
	git merge --allow-unrelated-histories five &&
	git diff --exit-code five
'

test_expect_success 'two-project merge with --allow-unrelated-histories with --autostash' '
	t3033_reset &&
	git reset --hard four &&
	echo change >>one.t &&
	git diff one.t >expect &&
	git merge --allow-unrelated-histories --autostash five 2>err &&
	test_i18ngrep "Applied autostash." err &&
	git diff one.t >actual &&
	test_cmp expect actual
'

test_done
debug log:

solving fdbd095cde ...
found fdbd095cde in https://public-inbox.org/git/1ef276c97efc63ca714b51083b364e3d6eac9ed4.1605221039.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/f0fa12b5774fa7041f507884fada95b46e7bb925.1605629548.git.gitgitgadget@gmail.com/
found e29c284b9b in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 e29c284b9b9b06a333c9e6d8b5240821403275b3	t/t6433-merge-toplevel.sh

applying [1/2] https://public-inbox.org/git/1ef276c97efc63ca714b51083b364e3d6eac9ed4.1605221039.git.gitgitgadget@gmail.com/
diff --git a/t/t6433-merge-toplevel.sh b/t/t6433-merge-toplevel.sh
index e29c284b9b..fdbd095cde 100755

Checking patch t/t6433-merge-toplevel.sh...
Applied patch t/t6433-merge-toplevel.sh cleanly.

skipping https://public-inbox.org/git/f0fa12b5774fa7041f507884fada95b46e7bb925.1605629548.git.gitgitgadget@gmail.com/ for fdbd095cde
index at:
100755 fdbd095cde3a3a446f481ea1cdce7fccafcf1907	t/t6433-merge-toplevel.sh

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).