git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 3804527e2e803e8498bee4686e6953994e518172 3212 bytes (raw)
name: t/t3504-cherry-pick-rerere.sh 	 # note: path name is non-authoritative(*)

  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
 
#!/bin/sh

test_description='cherry-pick should rerere for conflicts'

. ./test-lib.sh

test_expect_success setup '
	test_commit foo &&
	test_commit foo-main foo &&
	test_commit bar-main bar &&

	git checkout -b dev foo &&
	test_commit foo-dev foo &&
	test_commit bar-dev bar &&
	git config rerere.enabled true
'

test_expect_success 'conflicting merge' '
	test_must_fail git merge main
'

test_expect_success 'fixup' '
	echo foo-resolved >foo &&
	echo bar-resolved >bar &&
	git commit -am resolved &&
	cp foo foo-expect &&
	cp bar bar-expect &&
	git reset --hard HEAD^
'

test_expect_success 'cherry-pick conflict with --rerere-autoupdate' '
	test_must_fail git cherry-pick --rerere-autoupdate foo..bar-main &&
	test_cmp foo-expect foo &&
	git diff-files --quiet &&
	test_must_fail git cherry-pick --continue &&
	test_cmp bar-expect bar &&
	git diff-files --quiet &&
	git cherry-pick --continue &&
	git reset --hard bar-dev
'

test_expect_success 'cherry-pick conflict repsects rerere.autoUpdate' '
	test_config rerere.autoUpdate true &&
	test_must_fail git cherry-pick foo..bar-main &&
	test_cmp foo-expect foo &&
	git diff-files --quiet &&
	test_must_fail git cherry-pick --continue &&
	test_cmp bar-expect bar &&
	git diff-files --quiet &&
	git cherry-pick --continue &&
	git reset --hard bar-dev
'

test_expect_success 'cherry-pick conflict with --no-rerere-autoupdate' '
	test_config rerere.autoUpdate true &&
	test_must_fail git cherry-pick --no-rerere-autoupdate foo..bar-main &&
	test_cmp foo-expect foo &&
	test_must_fail git diff-files --quiet &&
	git add foo &&
	test_must_fail git cherry-pick --continue &&
	test_cmp bar-expect bar &&
	test_must_fail git diff-files --quiet &&
	git add bar &&
	git cherry-pick --continue &&
	git reset --hard bar-dev
'

test_expect_success 'cherry-pick --continue rejects --rerere-autoupdate' '
	test_must_fail git cherry-pick --rerere-autoupdate foo..bar-main &&
	test_cmp foo-expect foo &&
	git diff-files --quiet &&
	test_must_fail git cherry-pick --continue --rerere-autoupdate >actual 2>&1 &&
	echo "fatal: cherry-pick: --rerere-autoupdate cannot be used with --continue" >expect &&
	test_i18ncmp expect actual &&
	test_must_fail git cherry-pick --continue --no-rerere-autoupdate >actual 2>&1 &&
	echo "fatal: cherry-pick: --no-rerere-autoupdate cannot be used with --continue" >expect &&
	test_i18ncmp expect actual &&
	git cherry-pick --abort
'

test_expect_success 'cherry-pick --rerere-autoupdate more than once' '
	test_must_fail git cherry-pick --rerere-autoupdate --rerere-autoupdate foo..bar-main &&
	test_cmp foo-expect foo &&
	git diff-files --quiet &&
	git cherry-pick --abort &&
	test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate --rerere-autoupdate foo..bar-main &&
	test_cmp foo-expect foo &&
	git diff-files --quiet &&
	git cherry-pick --abort &&
	test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate foo..bar-main &&
	test_must_fail git diff-files --quiet &&
	git cherry-pick --abort
'

test_expect_success 'cherry-pick conflict without rerere' '
	test_config rerere.enabled false &&
	test_must_fail git cherry-pick foo-main &&
	grep ===== foo &&
	grep foo-dev foo &&
	grep foo-main foo
'

test_done

debug log:

solving 3804527e2e ...
found 3804527e2e in https://public-inbox.org/git/7a9349653dda0723b11484a9923e58fba11f254c.1605221039.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/0cf754646e13bcbe117834addbf7d281f66a7955.1605629548.git.gitgitgadget@gmail.com/
found 80a0d08706 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 80a0d087065398732a8ca74bb87c4509b3c8b0b1	t/t3504-cherry-pick-rerere.sh

applying [1/1] https://public-inbox.org/git/7a9349653dda0723b11484a9923e58fba11f254c.1605221039.git.gitgitgadget@gmail.com/
diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh
index 80a0d08706..3804527e2e 100755

Checking patch t/t3504-cherry-pick-rerere.sh...
Applied patch t/t3504-cherry-pick-rerere.sh cleanly.

skipping https://public-inbox.org/git/0cf754646e13bcbe117834addbf7d281f66a7955.1605629548.git.gitgitgadget@gmail.com/ for 3804527e2e
index at:
100755 3804527e2e803e8498bee4686e6953994e518172	t/t3504-cherry-pick-rerere.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public 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).