tests/run-tests.html: move noscript into body
[git-browser.git] / tests / mk-test-git.sh
blob11d501b017ee2c8a8eb010ec0b8dcb6f12a5c268
1 #!/bin/sh
3 set -e
4 cd "$(dirname "$0")"
6 # git_add_config "some.var=value"
7 # every ' in value must be replaced with the 4-character sequence '\'' before
8 # calling this function or Git will barf. Will not be effective unless running
9 # Git version 1.7.3 or later.
10 git_add_config() {
11 GIT_CONFIG_PARAMETERS="${GIT_CONFIG_PARAMETERS:+$GIT_CONFIG_PARAMETERS }'$1'"
12 export GIT_CONFIG_PARAMETERS
14 git_add_config "user.name=Git-Browser Test"
15 git_add_config "user.email=-"
16 git_add_config "rerere.enabled=false"
18 mkdir test.git
19 export GIT_DIR=test.git
20 git init
21 git config core.bare false
22 git config core.logallrefupdates false
24 echo "Hello World" >hello
25 echo "Silly example" >example
26 mkdir dir
27 echo "file in a dir" >dir/file
29 git add hello example dir/file
30 echo "It's a new day for git" >>hello
31 git commit -m "initial commit"
32 sleep 1
34 git add hello
35 git commit -m "bring hello up to date"
36 sleep 1
37 git tag my-first-tag
39 git checkout -b mybranch
40 echo "Work, work, work" >>hello
41 git commit -m 'Some work.' hello
42 sleep 1
45 git checkout master
46 echo "Play, play, play" >>hello
47 echo "Lots of fun" >>example
48 git commit -m 'Some fun.' hello example
49 sleep 1
52 git merge -m "Merge work in mybranch" mybranch || :
53 echo "Hello World" >hello
54 echo "It's a new day for git" >>hello
55 echo "Play, play, play" >>hello
56 echo "Work, work, work" >>hello
57 git add hello
58 git commit -m "mybranch merged"
60 rm hello
61 rm example
62 rm dir/file
63 rmdir dir
64 git config core.bare true
65 rm -f "$GIT_DIR/index" "$GIT_DIR/ORIG_HEAD" "$GIT_DIR/COMMIT_EDITMSG"
66 git pack-refs --all --prune
67 git repack -a -d
68 git prune --expire=now
71 cat <<CONF >../git-browser.conf
72 gitbin: $(command -v git)
73 warehouse: $(cd .. && pwd -P)
74 repos:
75 test tests/test.git
76 boo no-such-dir
77 CONF
79 cat <<'CONF' >../lighttpd.conf
80 port = 8080
81 include_shell "echo \"confdir = \\"`pwd -P`\\"\""
82 server.document-root = confdir
83 server.port = port
84 server.bind = "127.0.0.1"
85 $SERVER["socket"] == "[::1]:"+port {}
86 server.modules = ( "mod_alias", "mod_cgi", "mod_accesslog" )
87 server.indexfiles = ( "index.html" )
88 cgi.assign = ( ".cgi" => "" )
89 mimetype.assign = ( ".html" => "text/html", ".css" => "text/css", ".js" => "text/javascript" )
90 alias.url = ( "/git-browser/" => confdir + "/" )
91 accesslog.filename = "/dev/stderr"
92 CONF