ref: 2a0ed585ce506b55d90e1c10142c2150ffa892e2
dir: /sys/src/cmd/git/test/merge.rc/
#!/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 chmod +x a 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 q 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 test -x b/a || die merge preserve exec ! test -x b/b || die merge preserve nonexec b ! test -x b/c || die merge preserve nonexec c @{rfork ne ; cd b ; git/fs; git/walk -q} || die merge commit dropped files echo @@ merge concurent edits @@ @{ rfork ne @{ cd a chmod -x a chmod +x b echo quux >>c q git/commit -m diverge2a a b 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 || {diff -u b/c <{echo $c}; die merge 1.c} ! test -x b/a || die merge remove exec test -x b/b || die merge add exec ! test -x b/c || die merge preserve nonexec c # repro for bug in git/save, around missing # files when saving the merged commit. mkdir -p scratch/james echo @@ james test @@ @{ cd scratch/james q git/init mkdir -p lib/ndb touch lib/words q git/add lib/words q git/commit -m 'add words' lib/words q git/branch -n myhead echo stuff > lib/ndb/local q git/add lib/ndb/local q git/commit -m 'Add lib/ndb/local' lib/ndb/local q git/branch front echo cromulent >> lib/words q git/commit -m 'Some change on front' lib/words q git/branch myhead q git/merge front q git/commit -m 'Merge front' d=`''{git/diff lib/words lib/ndb/local} # should have no output if(! ~ $d ''){ echo $d exit diff } exit '' }