git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
b87537ca7d0f80d218afc95dbf14818525ad16b6 blob 4996 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
 
#!/bin/sh
#
# Copyright (c) 2019 Denton Liu
#

test_description='ensure rebase fast-forwards commits when possible'

. ./test-lib.sh

test_expect_success setup '
	test_commit A &&
	test_commit B &&
	test_commit C &&
	test_commit D &&
	git checkout -t -b side
'

test_rebase_same_head () {
	status_n="$1" &&
	shift &&
	what_n="$1" &&
	shift &&
	cmp_n="$1" &&
	shift &&
	status_f="$1" &&
	shift &&
	what_f="$1" &&
	shift &&
	cmp_f="$1" &&
	shift &&
	test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --apply" "$*" &&
	test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --apply --no-ff" "$*"
	test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --merge" "$*" &&
	test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --merge --no-ff" "$*"
	test_rebase_same_head_ $status_n $what_n $cmp_n 1 " --merge" "$*" &&
	test_rebase_same_head_ $status_f $what_f $cmp_f 1 " --merge --no-ff" "$*"
}

test_rebase_same_head_ () {
	status="$1" &&
	shift &&
	what="$1" &&
	shift &&
	cmp="$1" &&
	shift &&
	abbreviate="$1" &&
	shift &&
	flag="$1"
	shift &&
	if test $abbreviate -eq 1
	then
		msg="git rebase$flag $* (rebase.abbreviateCommands = true) with $changes is $what with $cmp HEAD"
	else
		msg="git rebase$flag $* with $changes is $what with $cmp HEAD"
	fi &&
	test_expect_$status "$msg" "
		if test $abbreviate -eq 1
		then
			test_config rebase.abbreviateCommands true
		fi &&
		oldhead=\$(git rev-parse HEAD) &&
		test_when_finished 'git reset --hard \$oldhead' &&
		git reflog HEAD >expect &&
		git rebase$flag $* >stdout &&
		git reflog HEAD >actual &&
		if test $what = work
		then
			old=\$(wc -l <expect) &&
			test_line_count '-gt' \$old actual
		elif test $what = noop
		then
			test_cmp expect actual
		fi &&
		newhead=\$(git rev-parse HEAD) &&
		if test $cmp = same
		then
			test_cmp_rev \$oldhead \$newhead
		elif test $cmp = diff
		then
			test_cmp_rev ! \$oldhead \$newhead
		fi
	"
}

changes='no changes'
test_rebase_same_head success noop same success work same
test_rebase_same_head success noop same success work same main
test_rebase_same_head success noop same success work diff --onto B B
test_rebase_same_head success noop same success work diff --onto B... B
test_rebase_same_head success noop same success work same --onto main... main
test_rebase_same_head success noop same success work same --keep-base main
test_rebase_same_head success noop same success work same --keep-base
test_rebase_same_head success noop same success work same --no-fork-point
test_rebase_same_head success noop same success work same --keep-base --no-fork-point
test_rebase_same_head success noop same success work same --fork-point main
test_rebase_same_head success noop same success work diff --fork-point --onto B B
test_rebase_same_head success noop same success work diff --fork-point --onto B... B
test_rebase_same_head success noop same success work same --fork-point --onto main... main
test_rebase_same_head success noop same success work same --keep-base --keep-base main

test_expect_success 'add work same to side' '
	test_commit E
'

changes='our changes'
test_rebase_same_head success noop same success work same
test_rebase_same_head success noop same success work same main
test_rebase_same_head success noop same success work diff --onto B B
test_rebase_same_head success noop same success work diff --onto B... B
test_rebase_same_head success noop same success work same --onto main... main
test_rebase_same_head success noop same success work same --keep-base main
test_rebase_same_head success noop same success work same --keep-base
test_rebase_same_head success noop same success work same --no-fork-point
test_rebase_same_head success noop same success work same --keep-base --no-fork-point
test_rebase_same_head success noop same success work same --fork-point main
test_rebase_same_head success noop same success work diff --fork-point --onto B B
test_rebase_same_head success noop same success work diff --fork-point --onto B... B
test_rebase_same_head success noop same success work same --fork-point --onto main... main
test_rebase_same_head success noop same success work same --fork-point --keep-base main

test_expect_success 'add work same to upstream' '
	git checkout main &&
	test_commit F &&
	git checkout side
'

changes='our and their changes'
test_rebase_same_head success noop same success work diff --onto B B
test_rebase_same_head success noop same success work diff --onto B... B
test_rebase_same_head success noop same success work diff --onto main... main
test_rebase_same_head success noop same success work diff --keep-base main
test_rebase_same_head success noop same success work diff --keep-base
test_rebase_same_head failure work same success work diff --fork-point --onto B B
test_rebase_same_head failure work same success work diff --fork-point --onto B... B
test_rebase_same_head success noop same success work diff --fork-point --onto main... main
test_rebase_same_head success noop same success work diff --fork-point --keep-base main

test_done
debug log:

solving b87537ca7d ...
`b87537ca7d' ambiguous in git.git.git
3324229025300f7d7de600753c03af3ac22e2152 blob

found b87537ca7d in https://public-inbox.org/git/ec7102156e055dfb3659821ebc9fa1b616f74100.1605221039.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/2f62b3f4694096b38deba3359c7705296b4209fd.1605629548.git.gitgitgadget@gmail.com/
found a29eda87e9 in git.git.git
preparing index
index prepared:
100755 a29eda87e9a1265bcddd300628bf43f4167e47e3	t/t3432-rebase-fast-forward.sh

applying [1/2] https://public-inbox.org/git/ec7102156e055dfb3659821ebc9fa1b616f74100.1605221039.git.gitgitgadget@gmail.com/
diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh
index a29eda87e9..b87537ca7d 100755

Checking patch t/t3432-rebase-fast-forward.sh...
Applied patch t/t3432-rebase-fast-forward.sh cleanly.

skipping https://public-inbox.org/git/2f62b3f4694096b38deba3359c7705296b4209fd.1605629548.git.gitgitgadget@gmail.com/ for b87537ca7d
index at:
100755 b87537ca7d0f80d218afc95dbf14818525ad16b6	t/t3432-rebase-fast-forward.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).