chiark / gitweb /
test suite: badcommit-fixup: Check core.sharedRepository works
[dgit.git] / tests / tests / badcommit-rewrite
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 t-setup-import examplegit
6 t-tstunt-parsechangelog
7
8 cd $tmp/git/$p.git
9 git config core.sharedRepository true
10 chmod -R g+w objects
11 umask 022
12
13 cd $tmp/example
14
15 suite=stable
16
17 t-commit 'No changes, just send to stable' '' stable
18
19 t-make-badcommit
20 git reset --hard $badcommit
21
22 t-dgit -wgf build
23 t-dgit push --overwrite=1.2 stable
24 t-archive-process-incoming stable
25
26 rstable=refs/remotes/dgit/dgit/stable
27
28 t-dgit fetch stable
29 t-has-parent-or-is $rstable $badcommit
30
31 fixup=${DGIT_BADCOMMIT_FIXUP-dgit-badcommit-fixup}
32
33 cd $tmp/git/$p.git
34 git gc --aggressive --prune=all
35 rmdir objects/* ||:
36
37 $fixup --real
38
39 cd $tmp/$p
40 git symbolic-ref HEAD >../sym.before
41 git rev-parse HEAD >../ref.before
42
43 $fixup --real
44
45 git symbolic-ref HEAD >../sym.after
46 git rev-parse HEAD >../ref.after
47 diff ../sym.before ../sym.after
48 set +e; diff ../ref.before ../ref.after; rc=$?; set -e; test $rc = 1
49
50 t-dgit fetch stable
51
52 t-expect-fail "child $rstable lacks parent $badcommit" \
53 t-has-parent-or-is $rstable $badcommit
54
55 check_shared () {
56         find "$1" -perm -200 \! -perm -020 -ls |tee $tmp/badperm
57         test -f $tmp/badperm -a ! -s $tmp/badperm
58 }
59
60 check_shared $tmp/git/$p.git/objects
61
62 t-ok