git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
35a61ce90bb54a241c780402145ed61630f7151e blob 3761 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
175
176
177
178
179
180
181
182
183
184
185
 
#!/bin/sh
#
# Copyright (c) 2017 Johannes E. Schindelin
#

test_description='git rebase -i --recreate-merges

This test runs git rebase "interactively", retaining the branch structure by
recreating merge commits.

Initial setup:

    -- B --                   (first)
   /       \
 A - C - D - E - H            (master)
       \       /
         F - G                (second)
'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh

test_expect_success 'setup' '
	write_script replace-editor.sh <<-\EOF &&
	mv "$1" "$(git rev-parse --git-path ORIGINAL-TODO)"
	cp script-from-scratch "$1"
	EOF

	test_commit A &&
	git checkout -b first &&
	test_commit B &&
	git checkout master &&
	test_commit C &&
	test_commit D &&
	git merge --no-commit B &&
	test_tick &&
	git commit -m E &&
	git tag -m E E &&
	git checkout -b second C &&
	test_commit F &&
	test_commit G &&
	git checkout master &&
	git merge --no-commit G &&
	test_tick &&
	git commit -m H &&
	git tag -m H H
'

cat >script-from-scratch <<\EOF
label onto

# onebranch
pick G
pick D
label onebranch

# second
reset onto
pick B
label second

reset onto
merge -C H second
merge onebranch # Merge the topic branch 'onebranch'
EOF

test_cmp_graph () {
	cat >expect &&
	git log --graph --boundary --format=%s "$@" >output &&
	sed "s/ *$//" <output >output.trimmed &&
	test_cmp expect output.trimmed
}

test_expect_success 'create completely different structure' '
	test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
	test_tick &&
	git rebase -i --recreate-merges A &&
	test_cmp_graph <<-\EOF
	*   Merge the topic branch '\''onebranch'\''
	|\
	| * D
	| * G
	* |   H
	|\ \
	| |/
	|/|
	| * B
	|/
	* A
	EOF
'

test_expect_success 'generate correct todo list' '
	cat >expect <<-\EOF &&
	label onto

	reset onto
	pick d9df450 B
	label E

	reset onto
	pick 5dee784 C
	label branch-point
	pick ca2c861 F
	pick 088b00a G
	label H

	reset branch-point # C
	pick 12bd07b D
	merge -C 2051b56 E # E
	merge -C 233d48a H # H

	EOF

	grep -v "^#" <.git/ORIGINAL-TODO >output &&
	test_cmp expect output
'

test_expect_success 'with a branch tip that was cherry-picked already' '
	git checkout -b already-upstream master &&
	base="$(git rev-parse --verify HEAD)" &&

	test_commit A1 &&
	test_commit A2 &&
	git reset --hard $base &&
	test_commit B1 &&
	test_tick &&
	git merge -m "Merge branch A" A2 &&

	git checkout -b upstream-with-a2 $base &&
	test_tick &&
	git cherry-pick A2 &&

	git checkout already-upstream &&
	test_tick &&
	git rebase -i --recreate-merges upstream-with-a2 &&
	test_cmp_graph upstream-with-a2.. <<-\EOF
	*   Merge branch A
	|\
	| * A1
	* | B1
	|/
	o A2
	EOF
'

test_expect_success 'refs/rewritten/* is worktree-local' '
	git worktree add wt &&
	cat >wt/script-from-scratch <<-\EOF &&
	label xyz
	exec GIT_DIR=../.git git rev-parse --verify refs/rewritten/xyz >a || :
	exec git rev-parse --verify refs/rewritten/xyz >b
	EOF

	test_config -C wt sequence.editor \""$PWD"/replace-editor.sh\" &&
	git -C wt rebase -i HEAD &&
	test_must_be_empty wt/a &&
	test_cmp_rev HEAD "$(cat wt/b)"
'

test_expect_success 'post-rewrite hook and fixups work for merges' '
	git checkout -b post-rewrite &&
	test_commit same1 &&
	git reset --hard HEAD^ &&
	test_commit same2 &&
	git merge -m "to fix up" same1 &&
	echo same old same old >same2.t &&
	test_tick &&
	git commit --fixup HEAD same2.t &&
	fixup="$(git rev-parse HEAD)" &&

	mkdir -p .git/hooks &&
	test_when_finished "rm .git/hooks/post-rewrite" &&
	echo "cat >actual" | write_script .git/hooks/post-rewrite &&

	test_tick &&
	git rebase -i --autosquash --recreate-merges HEAD^^^ &&
	printf "%s %s\n%s %s\n%s %s\n%s %s\n" >expect $(git rev-parse \
		$fixup^^2 HEAD^2 \
		$fixup^^ HEAD^ \
		$fixup^ HEAD \
		$fixup HEAD) &&
	test_cmp expect actual
'

test_done
debug log:

solving 35a61ce90bb ...
found 35a61ce90bb in https://public-inbox.org/git/8ecddf181eeaa9c6bfc9ff573562f9bd9d3d32a5.1519680483.git.johannes.schindelin@gmx.de/
	https://public-inbox.org/git/8ecddf181eeaa9c6bfc9ff573562f9bd9d3d32a5.1519389319.git.johannes.schindelin@gmx.de/
	https://public-inbox.org/git/90cad9f560f127528b2f1d790c7add43c3bb6543.1518307772.git.johannes.schindelin@gmx.de/
found 1a3e43d66ff in https://public-inbox.org/git/620954c3c964cdaa43b41b598b3c508cd6be9049.1519680483.git.johannes.schindelin@gmx.de/
	https://public-inbox.org/git/620954c3c964cdaa43b41b598b3c508cd6be9049.1519389319.git.johannes.schindelin@gmx.de/
	https://public-inbox.org/git/43ec5206b6c91279ad322cc2518629bd7769c0d1.1518307772.git.johannes.schindelin@gmx.de/
found 0073601a206 in https://public-inbox.org/git/f17e265d824a25dace1d6bf7c545e1061d746993.1518307772.git.johannes.schindelin@gmx.de/
	https://public-inbox.org/git/31098ae586dcd2c5b08e3f7db1a99d1ccef64ed8.1519680483.git.johannes.schindelin@gmx.de/
	https://public-inbox.org/git/31098ae586dcd2c5b08e3f7db1a99d1ccef64ed8.1519389319.git.johannes.schindelin@gmx.de/

applying [1/9] https://public-inbox.org/git/f17e265d824a25dace1d6bf7c545e1061d746993.1518307772.git.johannes.schindelin@gmx.de/
diff --git a/t/t3430-rebase-recreate-merges.sh b/t/t3430-rebase-recreate-merges.sh
new file mode 100755
index 00000000000..0073601a206

Checking patch t/t3430-rebase-recreate-merges.sh...
Applied patch t/t3430-rebase-recreate-merges.sh cleanly.

skipping https://public-inbox.org/git/31098ae586dcd2c5b08e3f7db1a99d1ccef64ed8.1519680483.git.johannes.schindelin@gmx.de/ for 0073601a206
skipping https://public-inbox.org/git/31098ae586dcd2c5b08e3f7db1a99d1ccef64ed8.1519389319.git.johannes.schindelin@gmx.de/ for 0073601a206
index at:
100755 0073601a2065fa908660071e440cf1430df64c70	t/t3430-rebase-recreate-merges.sh

applying [2/9] https://public-inbox.org/git/620954c3c964cdaa43b41b598b3c508cd6be9049.1519680483.git.johannes.schindelin@gmx.de/
diff --git a/t/t3430-rebase-recreate-merges.sh b/t/t3430-rebase-recreate-merges.sh
index 0073601a206..1a3e43d66ff 100755

Checking patch t/t3430-rebase-recreate-merges.sh...
Applied patch t/t3430-rebase-recreate-merges.sh cleanly.

skipping https://public-inbox.org/git/620954c3c964cdaa43b41b598b3c508cd6be9049.1519389319.git.johannes.schindelin@gmx.de/ for 1a3e43d66ff
skipping https://public-inbox.org/git/43ec5206b6c91279ad322cc2518629bd7769c0d1.1518307772.git.johannes.schindelin@gmx.de/ for 1a3e43d66ff
index at:
100755 1a3e43d66ffe873c9822b38824d4517a2b34eecb	t/t3430-rebase-recreate-merges.sh

applying [3/9] https://public-inbox.org/git/8ecddf181eeaa9c6bfc9ff573562f9bd9d3d32a5.1519680483.git.johannes.schindelin@gmx.de/
diff --git a/t/t3430-rebase-recreate-merges.sh b/t/t3430-rebase-recreate-merges.sh
index 1a3e43d66ff..35a61ce90bb 100755

Checking patch t/t3430-rebase-recreate-merges.sh...
Applied patch t/t3430-rebase-recreate-merges.sh cleanly.

skipping https://public-inbox.org/git/8ecddf181eeaa9c6bfc9ff573562f9bd9d3d32a5.1519389319.git.johannes.schindelin@gmx.de/ for 35a61ce90bb
skipping https://public-inbox.org/git/90cad9f560f127528b2f1d790c7add43c3bb6543.1518307772.git.johannes.schindelin@gmx.de/ for 35a61ce90bb
index at:
100755 35a61ce90bb54a241c780402145ed61630f7151e	t/t3430-rebase-recreate-merges.sh

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git