git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 19639ffe598ec90e67a7013234bf3f5a125326b7 3933 bytes (raw)
name: t/t5515-fetch-merge-logic.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
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
 
#!/bin/sh
#
# Copyright (c) 2007 Santi Béjar, based on t4013 by Junio C Hamano
#
#

test_description='Merge logic in fetch'

. ./test-lib.sh

LF='
'

test_expect_success setup '
	GIT_AUTHOR_DATE="2006-06-26 00:00:00 +0000" &&
	GIT_COMMITTER_DATE="2006-06-26 00:00:00 +0000" &&
	export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

	echo >file original &&
	git add file &&
	git commit -a -m One &&
	git tag tag-one &&
	git tag tag-one-tree HEAD^{tree} &&
	git branch one &&

	echo two >> file &&
	git commit -a -m Two &&
	git tag -a -m "Tag Two" tag-two &&
	git branch two &&

	echo three >> file &&
	git commit -a -m Three &&
	git tag -a -m "Tag Three" tag-three &&
	git tag -a -m "Tag Three file" tag-three-file HEAD^{tree}:file &&
	git branch three &&

	echo master >> file &&
	git commit -a -m Master &&
	git tag -a -m "Tag Master" tag-master &&

	git checkout three &&

	git clone . cloned &&
	cd cloned &&
	git config remote.origin.url ../.git/ &&

	git config remote.config-explicit.url ../.git/ &&
	git config remote.config-explicit.fetch refs/heads/master:remotes/rem/master &&
	git config --add remote.config-explicit.fetch refs/heads/one:remotes/rem/one &&
	git config --add remote.config-explicit.fetch two:remotes/rem/two &&
	git config --add remote.config-explicit.fetch refs/heads/three:remotes/rem/three &&
	remotes="config-explicit" &&

	git config remote.config-glob.url ../.git/ &&
	git config remote.config-glob.fetch refs/heads/*:refs/remotes/rem/* &&
	remotes="$remotes config-glob" &&

	for remote in $remotes ; do
		git config branch.br-$remote.remote $remote &&
		git config branch.br-$remote-merge.remote $remote &&
		git config branch.br-$remote-merge.merge refs/heads/three &&
		git config branch.br-$remote-octopus.remote $remote &&
		git config branch.br-$remote-octopus.merge refs/heads/one &&
		git config --add branch.br-$remote-octopus.merge two
	done
'

# Merge logic depends on branch properties and Pull: or .fetch lines
for remote in $remotes ; do
    for branch in "" "-merge" "-octopus" ; do
cat <<EOF
br-$remote$branch
br-$remote$branch $remote
EOF
    done
done > tests

# Merge logic does not depend on branch properties,
# but does depend on Pull: or fetch lines.
# Use two branches completely unrelated from the arguments,
# the clone default and one without branch properties
for branch in master br-unconfig ; do
    echo $branch
    for remote in $remotes ; do
	echo $branch $remote
    done
done >> tests

# Merge logic does not depend on branch properties
# neither in the Pull: or .fetch config
for branch in master br-unconfig ; do
    cat <<EOF
$branch ../.git
$branch ../.git one
$branch ../.git one two
$branch --tags ../.git
$branch ../.git tag tag-one tag tag-three
$branch ../.git tag tag-one-tree tag tag-three-file
$branch ../.git one tag tag-one tag tag-three-file
EOF
done >> tests

while read cmd
do
	case "$cmd" in
	'' | '#'*) continue ;;
	esac
	test=$(echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g')
	pfx=$(printf "%04d" $test_count)
	expect_f="$TEST_DIRECTORY/t5515/fetch.$test"
	actual_f="$pfx-fetch.$test"
	expect_r="$TEST_DIRECTORY/t5515/refs.$test"
	actual_r="$pfx-refs.$test"

	test_expect_success "$cmd" '
		{
			echo "# $cmd"
			set x $cmd; shift
			git symbolic-ref HEAD refs/heads/$1 ; shift
			rm -f .git/FETCH_HEAD
			git for-each-ref \
				refs/heads refs/remotes/rem refs/tags |
			while read val type refname
			do
				git update-ref -d "$refname" "$val"
			done
			git fetch "$@" >/dev/null
			cat .git/FETCH_HEAD
		} >"$actual_f" &&
		git show-ref >"$actual_r" &&
		if test -f "$expect_f"
		then
			test_cmp "$expect_f" "$actual_f" &&
			rm -f "$actual_f"
		else
			# this is to help developing new tests.
			cp "$actual_f" "$expect_f"
			false
		fi &&
		if test -f "$expect_r"
		then
			test_cmp "$expect_r" "$actual_r" &&
			rm -f "$actual_r"
		else
			# this is to help developing new tests.
			cp "$actual_r" "$expect_r"
			false
		fi
	'
done < tests

test_done

debug log:

solving 19639ffe598 ...
found 19639ffe598 in https://public-inbox.org/git/b9fcc61b2e01a7b97057f5aa5b307bdf5dae8587.1494509599.git.johannes.schindelin@gmx.de/
found 36b0dbc01cf in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 36b0dbc01cffc06aefb180179965ccbaa9c983d8	t/t5515-fetch-merge-logic.sh

applying [1/1] https://public-inbox.org/git/b9fcc61b2e01a7b97057f5aa5b307bdf5dae8587.1494509599.git.johannes.schindelin@gmx.de/
diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index 36b0dbc01cf..19639ffe598 100755

Checking patch t/t5515-fetch-merge-logic.sh...
Applied patch t/t5515-fetch-merge-logic.sh cleanly.

index at:
100755 19639ffe598ec90e67a7013234bf3f5a125326b7	t/t5515-fetch-merge-logic.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).