git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 9e15ceb9574f3044e17dcccd835fc2b3040ee48c 2366 bytes (raw)
name: t/t6060-merge-index.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
104
105
 
#!/bin/sh

test_description='basic git merge-index / git-merge-one-file tests'
. ./test-lib.sh

test_expect_success 'setup diverging branches' '
	for i in 1 2 3 4 5 6 7 8 9 10; do
		echo $i
	done >file &&
	cp file file2 &&
	git add file file2 &&
	git commit -m base &&
	git tag base &&
	sed s/2/two/ <file >tmp &&
	mv tmp file &&
	cp file file2 &&
	git commit -a -m two &&
	git tag two &&
	git checkout -b other HEAD^ &&
	sed s/10/ten/ <file >tmp &&
	mv tmp file &&
	cp file file2 &&
	git commit -a -m ten &&
	git tag ten
'

cat >expect-merged <<'EOF'
1
two
3
4
5
6
7
8
9
ten
EOF

test_expect_success 'read-tree does not resolve content merge' '
	cat >expect <<-\EOF &&
	file
	file2
	EOF
	git read-tree -i -m base ten two &&
	git diff-files --name-only --diff-filter=U >unmerged &&
	test_cmp expect unmerged
'

test_expect_success 'git merge-index git-merge-one-file resolves' '
	git merge-index git-merge-one-file -a &&
	git diff-files --name-only --diff-filter=U >unmerged &&
	test_must_be_empty unmerged &&
	test_cmp expect-merged file &&
	git cat-file blob :file >file-index &&
	test_cmp expect-merged file-index
'

test_expect_success 'setup bare merge' '
	git clone --bare . bare.git &&
	(cd bare.git &&
	 GIT_INDEX_FILE=$PWD/merge.index &&
	 export GIT_INDEX_FILE &&
	 git read-tree -i -m base ten two
	)
'

test_expect_success 'merge-one-file fails without a work tree' '
	(cd bare.git &&
	 GIT_INDEX_FILE=$PWD/merge.index &&
	 export GIT_INDEX_FILE &&
	 test_must_fail git merge-index git-merge-one-file -a
	)
'

test_expect_success 'merge-one-file respects GIT_WORK_TREE' '
	(cd bare.git &&
	 mkdir work &&
	 GIT_WORK_TREE=$PWD/work &&
	 export GIT_WORK_TREE &&
	 GIT_INDEX_FILE=$PWD/merge.index &&
	 export GIT_INDEX_FILE &&
	 git merge-index git-merge-one-file -a &&
	 git cat-file blob :file >work/file-index
	) &&
	test_cmp expect-merged bare.git/work/file &&
	test_cmp expect-merged bare.git/work/file-index
'

test_expect_success 'merge-one-file respects core.worktree' '
	mkdir subdir &&
	git clone . subdir/child &&
	(cd subdir &&
	 GIT_DIR=$PWD/child/.git &&
	 export GIT_DIR &&
	 git config core.worktree "$PWD/child" &&
	 git read-tree -i -m base ten two &&
	 git merge-index git-merge-one-file -a &&
	 git cat-file blob :file >file-index
	) &&
	test_cmp expect-merged subdir/child/file &&
	test_cmp expect-merged subdir/file-index
'

test_done

debug log:

solving 9e15ceb957 ...
found 9e15ceb957 in https://public-inbox.org/git/20201124115315.13311-3-alban.gruin@gmail.com/ ||
	https://public-inbox.org/git/20210317204939.17890-3-alban.gruin@gmail.com/
found ddf34f0115 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 ddf34f0115b08b401a8981099459d10e1b1c4a02	t/t6060-merge-index.sh

applying [1/1] https://public-inbox.org/git/20201124115315.13311-3-alban.gruin@gmail.com/
diff --git a/t/t6060-merge-index.sh b/t/t6060-merge-index.sh
index ddf34f0115..9e15ceb957 100755

Checking patch t/t6060-merge-index.sh...
Applied patch t/t6060-merge-index.sh cleanly.

skipping https://public-inbox.org/git/20210317204939.17890-3-alban.gruin@gmail.com/ for 9e15ceb957
index at:
100755 9e15ceb9574f3044e17dcccd835fc2b3040ee48c	t/t6060-merge-index.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).