shithub: regress

ref: fa29f36fe713a4bbdfca6770ebb3867436c1ac18
dir: /cmd/git/merge.rc/

View raw version
#!/bin/rc

. ../util.rc

rm -fr scratch
mkdir -p scratch
cd scratch
c='foo
bar
baz
'

# setup test repo
@{
	rfork ne
	q git/init a

	cd a
	echo hello > a
	echo goodbye > b
	echo -n $c > c
	q git/add a b c
	q git/commit -m v1 .
	cd ..
	pwd
	q git/clone `{pwd}^/a b
}

echo @@ merge different files @@
@{
	rfork ne
	@{
		cd a
		echo x > a
		q git/commit -m diverge1a a
	}
	@{
		cd b
		echo y > b
		q git/commit -m diverge1b b
	}

	@{
		cd b
		qq git/pull
		qq git/merge origin/front || status=''
		q git/commit -m merged .
	}
}

flag +x
~ `{cat b/a} x || die merge 1.a
~ `{cat b/b} y || die merge 1.b
~ `''{cat b/c} $c || die merge 1.c

echo @@ merge concurent edits @@
@{
	rfork ne
	@{
		cd a
		echo quux >>c
		q git/commit -m diverge2a c
	}
	@{
		cd b
		sed s/foo/FOO/ <c >c.new
		mv c.new c
		q git/commit -m diverge2b c

		qq git/pull
		qq git/merge origin/front
		q git/commit -m merge c
	}
}

c='FOO
bar
baz
quux
'
~ `{cat b/a} x || die	# commit from a
~ `{cat b/b} y || die # commit from b
~ `''{cat b/c} $c || die merge 1.c