Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007 Jakub Narebski |
| 4 | # |
| 5 | |
| 6 | test_description='gitweb as standalone script (basic tests). |
| 7 | |
| 8 | This test runs gitweb (git web interface) as CGI script from |
| 9 | commandline, and checks that it would not write any errors |
| 10 | or warnings to log.' |
| 11 | |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 12 | |
Mark Rada | 0552607 | 2009-08-27 22:07:07 -0400 | [diff] [blame] | 13 | . ./gitweb-lib.sh |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 14 | |
| 15 | # ---------------------------------------------------------------------- |
| 16 | # no commits (empty, just initialized repository) |
| 17 | |
| 18 | test_expect_success \ |
| 19 | 'no commits: projects_list (implicit)' \ |
| 20 | 'gitweb_run' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 21 | |
| 22 | test_expect_success \ |
| 23 | 'no commits: projects_index' \ |
| 24 | 'gitweb_run "a=project_index"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 25 | |
| 26 | test_expect_success \ |
| 27 | 'no commits: .git summary (implicit)' \ |
| 28 | 'gitweb_run "p=.git"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 29 | |
| 30 | test_expect_success \ |
| 31 | 'no commits: .git commit (implicit HEAD)' \ |
| 32 | 'gitweb_run "p=.git;a=commit"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 33 | |
| 34 | test_expect_success \ |
| 35 | 'no commits: .git commitdiff (implicit HEAD)' \ |
| 36 | 'gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 37 | |
| 38 | test_expect_success \ |
| 39 | 'no commits: .git tree (implicit HEAD)' \ |
| 40 | 'gitweb_run "p=.git;a=tree"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 41 | |
| 42 | test_expect_success \ |
| 43 | 'no commits: .git heads' \ |
| 44 | 'gitweb_run "p=.git;a=heads"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 45 | |
| 46 | test_expect_success \ |
| 47 | 'no commits: .git tags' \ |
| 48 | 'gitweb_run "p=.git;a=tags"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 49 | |
| 50 | |
| 51 | # ---------------------------------------------------------------------- |
| 52 | # initial commit |
| 53 | |
| 54 | test_expect_success \ |
| 55 | 'Make initial commit' \ |
| 56 | 'echo "Not an empty file." > file && |
| 57 | git add file && |
| 58 | git commit -a -m "Initial commit." && |
| 59 | git branch b' |
| 60 | |
| 61 | test_expect_success \ |
| 62 | 'projects_list (implicit)' \ |
| 63 | 'gitweb_run' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 64 | |
| 65 | test_expect_success \ |
| 66 | 'projects_index' \ |
| 67 | 'gitweb_run "a=project_index"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 68 | |
| 69 | test_expect_success \ |
| 70 | '.git summary (implicit)' \ |
| 71 | 'gitweb_run "p=.git"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 72 | |
| 73 | test_expect_success \ |
| 74 | '.git commit (implicit HEAD)' \ |
| 75 | 'gitweb_run "p=.git;a=commit"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 76 | |
| 77 | test_expect_success \ |
| 78 | '.git commitdiff (implicit HEAD, root commit)' \ |
| 79 | 'gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 80 | |
| 81 | test_expect_success \ |
| 82 | '.git commitdiff_plain (implicit HEAD, root commit)' \ |
| 83 | 'gitweb_run "p=.git;a=commitdiff_plain"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 84 | |
| 85 | test_expect_success \ |
| 86 | '.git commit (HEAD)' \ |
| 87 | 'gitweb_run "p=.git;a=commit;h=HEAD"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 88 | |
| 89 | test_expect_success \ |
| 90 | '.git tree (implicit HEAD)' \ |
| 91 | 'gitweb_run "p=.git;a=tree"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 92 | |
| 93 | test_expect_success \ |
| 94 | '.git blob (file)' \ |
| 95 | 'gitweb_run "p=.git;a=blob;f=file"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 96 | |
| 97 | test_expect_success \ |
| 98 | '.git blob_plain (file)' \ |
| 99 | 'gitweb_run "p=.git;a=blob_plain;f=file"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 100 | |
| 101 | # ---------------------------------------------------------------------- |
| 102 | # nonexistent objects |
| 103 | |
| 104 | test_expect_success \ |
| 105 | '.git commit (non-existent)' \ |
| 106 | 'gitweb_run "p=.git;a=commit;h=non-existent"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 107 | |
| 108 | test_expect_success \ |
| 109 | '.git commitdiff (non-existent)' \ |
| 110 | 'gitweb_run "p=.git;a=commitdiff;h=non-existent"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 111 | |
| 112 | test_expect_success \ |
| 113 | '.git commitdiff (non-existent vs HEAD)' \ |
| 114 | 'gitweb_run "p=.git;a=commitdiff;hp=non-existent;h=HEAD"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 115 | |
| 116 | test_expect_success \ |
| 117 | '.git tree (0000000000000000000000000000000000000000)' \ |
| 118 | 'gitweb_run "p=.git;a=tree;h=0000000000000000000000000000000000000000"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 119 | |
| 120 | test_expect_success \ |
| 121 | '.git tag (0000000000000000000000000000000000000000)' \ |
| 122 | 'gitweb_run "p=.git;a=tag;h=0000000000000000000000000000000000000000"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 123 | |
| 124 | test_expect_success \ |
| 125 | '.git blob (non-existent)' \ |
| 126 | 'gitweb_run "p=.git;a=blob;f=non-existent"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 127 | |
| 128 | test_expect_success \ |
| 129 | '.git blob_plain (non-existent)' \ |
| 130 | 'gitweb_run "p=.git;a=blob_plain;f=non-existent"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 131 | |
| 132 | |
| 133 | # ---------------------------------------------------------------------- |
| 134 | # commitdiff testing (implicit, one implicit tree-ish) |
| 135 | |
| 136 | test_expect_success \ |
| 137 | 'commitdiff(0): root' \ |
| 138 | 'gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 139 | |
| 140 | test_expect_success \ |
| 141 | 'commitdiff(0): file added' \ |
| 142 | 'echo "New file" > new_file && |
| 143 | git add new_file && |
| 144 | git commit -a -m "File added." && |
| 145 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 146 | |
| 147 | test_expect_success \ |
| 148 | 'commitdiff(0): mode change' \ |
Johannes Sixt | 1f55391 | 2009-02-28 21:12:57 +0100 | [diff] [blame] | 149 | 'test_chmod +x new_file && |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 150 | git commit -a -m "Mode changed." && |
| 151 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 152 | |
| 153 | test_expect_success \ |
| 154 | 'commitdiff(0): file renamed' \ |
| 155 | 'git mv new_file renamed_file && |
| 156 | git commit -a -m "File renamed." && |
| 157 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 158 | |
Johannes Sixt | 889c6f0 | 2013-06-07 22:53:28 +0200 | [diff] [blame] | 159 | test_expect_success \ |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 160 | 'commitdiff(0): file to symlink' \ |
| 161 | 'rm renamed_file && |
Johannes Sixt | 889c6f0 | 2013-06-07 22:53:28 +0200 | [diff] [blame] | 162 | test_ln_s_add file renamed_file && |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 163 | git commit -a -m "File to symlink." && |
| 164 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 165 | |
| 166 | test_expect_success \ |
| 167 | 'commitdiff(0): file deleted' \ |
| 168 | 'git rm renamed_file && |
| 169 | rm -f renamed_file && |
| 170 | git commit -a -m "File removed." && |
| 171 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 172 | |
| 173 | test_expect_success \ |
| 174 | 'commitdiff(0): file copied / new file' \ |
| 175 | 'cp file file2 && |
| 176 | git add file2 && |
| 177 | git commit -a -m "File copied." && |
| 178 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 179 | |
| 180 | test_expect_success \ |
| 181 | 'commitdiff(0): mode change and modified' \ |
| 182 | 'echo "New line" >> file2 && |
Johannes Sixt | 1f55391 | 2009-02-28 21:12:57 +0100 | [diff] [blame] | 183 | test_chmod +x file2 && |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 184 | git commit -a -m "Mode change and modification." && |
| 185 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 186 | |
| 187 | test_expect_success \ |
| 188 | 'commitdiff(0): renamed and modified' \ |
| 189 | 'cat >file2<<EOF && |
| 190 | Dominus regit me, |
| 191 | et nihil mihi deerit. |
| 192 | In loco pascuae ibi me collocavit, |
| 193 | super aquam refectionis educavit me; |
| 194 | animam meam convertit, |
| 195 | deduxit me super semitas jusitiae, |
| 196 | propter nomen suum. |
| 197 | EOF |
| 198 | git commit -a -m "File added." && |
| 199 | git mv file2 file3 && |
| 200 | echo "Propter nomen suum." >> file3 && |
| 201 | git commit -a -m "File rename and modification." && |
| 202 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 203 | |
| 204 | test_expect_success \ |
| 205 | 'commitdiff(0): renamed, mode change and modified' \ |
| 206 | 'git mv file3 file2 && |
| 207 | echo "Propter nomen suum." >> file2 && |
Johannes Sixt | 1f55391 | 2009-02-28 21:12:57 +0100 | [diff] [blame] | 208 | test_chmod +x file2 && |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 209 | git commit -a -m "File rename, mode change and modification." && |
| 210 | gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 211 | |
| 212 | # ---------------------------------------------------------------------- |
| 213 | # commitdiff testing (taken from t4114-apply-typechange.sh) |
| 214 | |
Johannes Sixt | 889c6f0 | 2013-06-07 22:53:28 +0200 | [diff] [blame] | 215 | test_expect_success 'setup typechange commits' ' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 216 | echo "hello world" > foo && |
| 217 | echo "hi planet" > bar && |
| 218 | git update-index --add foo bar && |
| 219 | git commit -m initial && |
| 220 | git branch initial && |
| 221 | rm -f foo && |
Johannes Sixt | 889c6f0 | 2013-06-07 22:53:28 +0200 | [diff] [blame] | 222 | test_ln_s_add bar foo && |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 223 | git commit -m "foo symlinked to bar" && |
| 224 | git branch foo-symlinked-to-bar && |
| 225 | rm -f foo && |
| 226 | echo "how far is the sun?" > foo && |
| 227 | git update-index foo && |
| 228 | git commit -m "foo back to file" && |
| 229 | git branch foo-back-to-file && |
| 230 | rm -f foo && |
| 231 | git update-index --remove foo && |
| 232 | mkdir foo && |
| 233 | echo "if only I knew" > foo/baz && |
| 234 | git update-index --add foo/baz && |
| 235 | git commit -m "foo becomes a directory" && |
| 236 | git branch "foo-becomes-a-directory" && |
| 237 | echo "hello world" > foo/baz && |
| 238 | git update-index foo/baz && |
| 239 | git commit -m "foo/baz is the original foo" && |
| 240 | git branch foo-baz-renamed-from-foo |
| 241 | ' |
| 242 | |
| 243 | test_expect_success \ |
| 244 | 'commitdiff(2): file renamed from foo to foo/baz' \ |
| 245 | 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-baz-renamed-from-foo"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 246 | |
| 247 | test_expect_success \ |
| 248 | 'commitdiff(2): file renamed from foo/baz to foo' \ |
| 249 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-baz-renamed-from-foo;h=initial"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 250 | |
| 251 | test_expect_success \ |
| 252 | 'commitdiff(2): directory becomes file' \ |
| 253 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=initial"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 254 | |
| 255 | test_expect_success \ |
| 256 | 'commitdiff(2): file becomes directory' \ |
| 257 | 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-becomes-a-directory"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 258 | |
| 259 | test_expect_success \ |
| 260 | 'commitdiff(2): file becomes symlink' \ |
| 261 | 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-symlinked-to-bar"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 262 | |
| 263 | test_expect_success \ |
| 264 | 'commitdiff(2): symlink becomes file' \ |
| 265 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-back-to-file"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 266 | |
| 267 | test_expect_success \ |
| 268 | 'commitdiff(2): symlink becomes directory' \ |
| 269 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-becomes-a-directory"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 270 | |
| 271 | test_expect_success \ |
| 272 | 'commitdiff(2): directory becomes symlink' \ |
| 273 | 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 274 | |
| 275 | # ---------------------------------------------------------------------- |
Jakub Narebski | e4bd10b | 2011-10-31 00:36:24 +0100 | [diff] [blame] | 276 | # commitdiff testing (incomplete lines) |
| 277 | |
| 278 | test_expect_success 'setup incomplete lines' ' |
| 279 | cat >file<<-\EOF && |
| 280 | Dominus regit me, |
| 281 | et nihil mihi deerit. |
| 282 | In loco pascuae ibi me collocavit, |
| 283 | super aquam refectionis educavit me; |
| 284 | animam meam convertit, |
| 285 | deduxit me super semitas jusitiae, |
| 286 | propter nomen suum. |
| 287 | CHANGE_ME |
| 288 | EOF |
| 289 | git commit -a -m "Preparing for incomplete lines" && |
| 290 | echo "incomplete" | tr -d "\\012" >>file && |
| 291 | git commit -a -m "Add incomplete line" && |
| 292 | git tag incomplete_lines_add && |
| 293 | sed -e s/CHANGE_ME/change_me/ <file >file+ && |
| 294 | mv -f file+ file && |
| 295 | git commit -a -m "Incomplete context line" && |
| 296 | git tag incomplete_lines_ctx && |
| 297 | echo "Dominus regit me," >file && |
| 298 | echo "incomplete line" | tr -d "\\012" >>file && |
| 299 | git commit -a -m "Change incomplete line" && |
Jeff King | 99094a7 | 2015-03-20 06:07:15 -0400 | [diff] [blame] | 300 | git tag incomplete_lines_chg && |
Jakub Narebski | e4bd10b | 2011-10-31 00:36:24 +0100 | [diff] [blame] | 301 | echo "Dominus regit me," >file && |
| 302 | git commit -a -m "Remove incomplete line" && |
| 303 | git tag incomplete_lines_rem |
| 304 | ' |
| 305 | |
| 306 | test_expect_success 'commitdiff(1): addition of incomplete line' ' |
| 307 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add" |
| 308 | ' |
| 309 | |
| 310 | test_expect_success 'commitdiff(1): incomplete line as context line' ' |
| 311 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx" |
| 312 | ' |
| 313 | |
| 314 | test_expect_success 'commitdiff(1): change incomplete line' ' |
| 315 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg" |
| 316 | ' |
| 317 | |
| 318 | test_expect_success 'commitdiff(1): removal of incomplete line' ' |
| 319 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem" |
| 320 | ' |
| 321 | |
| 322 | # ---------------------------------------------------------------------- |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 323 | # commit, commitdiff: merge, large |
| 324 | test_expect_success \ |
| 325 | 'Create a merge' \ |
| 326 | 'git checkout b && |
| 327 | echo "Branch" >> b && |
| 328 | git add b && |
| 329 | git commit -a -m "On branch" && |
| 330 | git checkout master && |
Felipe Contreras | 501a75a | 2013-10-31 03:25:33 -0600 | [diff] [blame] | 331 | git merge b && |
Jakub Narebski | 1e706ec | 2011-10-31 00:36:25 +0100 | [diff] [blame] | 332 | git tag merge_commit' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 333 | |
| 334 | test_expect_success \ |
| 335 | 'commit(0): merge commit' \ |
| 336 | 'gitweb_run "p=.git;a=commit"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 337 | |
| 338 | test_expect_success \ |
| 339 | 'commitdiff(0): merge commit' \ |
| 340 | 'gitweb_run "p=.git;a=commitdiff"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 341 | |
| 342 | test_expect_success \ |
| 343 | 'Prepare large commit' \ |
| 344 | 'git checkout b && |
| 345 | echo "To be changed" > 01-change && |
| 346 | echo "To be renamed" > 02-pure-rename-from && |
| 347 | echo "To be deleted" > 03-delete && |
| 348 | echo "To be renamed and changed" > 04-rename-from && |
| 349 | echo "To have mode changed" > 05-mode-change && |
| 350 | echo "File to symlink" > 06-file-or-symlink && |
| 351 | echo "To be changed and have mode changed" > 07-change-mode-change && |
| 352 | git add 0* && |
| 353 | git commit -a -m "Prepare large commit" && |
| 354 | echo "Changed" > 01-change && |
| 355 | git mv 02-pure-rename-from 02-pure-rename-to && |
| 356 | git rm 03-delete && rm -f 03-delete && |
| 357 | echo "A new file" > 03-new && |
| 358 | git add 03-new && |
| 359 | git mv 04-rename-from 04-rename-to && |
| 360 | echo "Changed" >> 04-rename-to && |
Johannes Sixt | 1f55391 | 2009-02-28 21:12:57 +0100 | [diff] [blame] | 361 | test_chmod +x 05-mode-change && |
Johannes Sixt | 704a314 | 2009-03-04 22:38:24 +0100 | [diff] [blame] | 362 | rm -f 06-file-or-symlink && |
Johannes Sixt | 889c6f0 | 2013-06-07 22:53:28 +0200 | [diff] [blame] | 363 | test_ln_s_add 01-change 06-file-or-symlink && |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 364 | echo "Changed and have mode changed" > 07-change-mode-change && |
Johannes Sixt | 1f55391 | 2009-02-28 21:12:57 +0100 | [diff] [blame] | 365 | test_chmod +x 07-change-mode-change && |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 366 | git commit -a -m "Large commit" && |
| 367 | git checkout master' |
| 368 | |
| 369 | test_expect_success \ |
| 370 | 'commit(1): large commit' \ |
| 371 | 'gitweb_run "p=.git;a=commit;h=b"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 372 | |
| 373 | test_expect_success \ |
| 374 | 'commitdiff(1): large commit' \ |
| 375 | 'gitweb_run "p=.git;a=commitdiff;h=b"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 376 | |
| 377 | # ---------------------------------------------------------------------- |
Jakub Narebski | 1e706ec | 2011-10-31 00:36:25 +0100 | [diff] [blame] | 378 | # side-by-side diff |
| 379 | |
| 380 | test_expect_success 'side-by-side: addition of incomplete line' ' |
| 381 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add;ds=sidebyside" |
| 382 | ' |
| 383 | |
| 384 | test_expect_success 'side-by-side: incomplete line as context line' ' |
| 385 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx;ds=sidebyside" |
| 386 | ' |
| 387 | |
| 388 | test_expect_success 'side-by-side: changed incomplete line' ' |
| 389 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg;ds=sidebyside" |
| 390 | ' |
| 391 | |
| 392 | test_expect_success 'side-by-side: removal of incomplete line' ' |
| 393 | gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem;ds=sidebyside" |
| 394 | ' |
| 395 | |
| 396 | test_expect_success 'side-by-side: merge commit' ' |
| 397 | gitweb_run "p=.git;a=commitdiff;h=merge_commit;ds=sidebyside" |
| 398 | ' |
| 399 | |
| 400 | # ---------------------------------------------------------------------- |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 401 | # tags testing |
| 402 | |
| 403 | test_expect_success \ |
| 404 | 'tags: list of different types of tags' \ |
| 405 | 'git checkout master && |
| 406 | git tag -a -m "Tag commit object" tag-commit HEAD && |
| 407 | git tag -a -m "" tag-commit-nomessage HEAD && |
| 408 | git tag -a -m "Tag tag object" tag-tag tag-commit && |
| 409 | git tag -a -m "Tag tree object" tag-tree HEAD^{tree} && |
| 410 | git tag -a -m "Tag blob object" tag-blob HEAD:file && |
| 411 | git tag lightweight/tag-commit HEAD && |
| 412 | git tag lightweight/tag-tag tag-commit && |
| 413 | git tag lightweight/tag-tree HEAD^{tree} && |
| 414 | git tag lightweight/tag-blob HEAD:file && |
| 415 | gitweb_run "p=.git;a=tags"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 416 | |
| 417 | test_expect_success \ |
| 418 | 'tag: Tag to commit object' \ |
| 419 | 'gitweb_run "p=.git;a=tag;h=tag-commit"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 420 | |
| 421 | test_expect_success \ |
| 422 | 'tag: on lightweight tag (invalid)' \ |
| 423 | 'gitweb_run "p=.git;a=tag;h=lightweight/tag-commit"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 424 | |
| 425 | # ---------------------------------------------------------------------- |
| 426 | # logs |
| 427 | |
| 428 | test_expect_success \ |
| 429 | 'logs: log (implicit HEAD)' \ |
| 430 | 'gitweb_run "p=.git;a=log"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 431 | |
| 432 | test_expect_success \ |
| 433 | 'logs: shortlog (implicit HEAD)' \ |
| 434 | 'gitweb_run "p=.git;a=shortlog"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 435 | |
| 436 | test_expect_success \ |
| 437 | 'logs: history (implicit HEAD, file)' \ |
| 438 | 'gitweb_run "p=.git;a=history;f=file"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 439 | |
Jakub Narebski | 5634cf2 | 2008-04-13 14:12:15 +0200 | [diff] [blame] | 440 | test_expect_success \ |
| 441 | 'logs: history (implicit HEAD, non-existent file)' \ |
| 442 | 'gitweb_run "p=.git;a=history;f=non-existent"' |
Jakub Narebski | 5634cf2 | 2008-04-13 14:12:15 +0200 | [diff] [blame] | 443 | |
| 444 | test_expect_success \ |
| 445 | 'logs: history (implicit HEAD, deleted file)' \ |
| 446 | 'git checkout master && |
| 447 | echo "to be deleted" > deleted_file && |
| 448 | git add deleted_file && |
| 449 | git commit -m "Add file to be deleted" && |
| 450 | git rm deleted_file && |
| 451 | git commit -m "Delete file" && |
| 452 | gitweb_run "p=.git;a=history;f=deleted_file"' |
Jakub Narebski | 5634cf2 | 2008-04-13 14:12:15 +0200 | [diff] [blame] | 453 | |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 454 | # ---------------------------------------------------------------------- |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 455 | # path_info links |
| 456 | test_expect_success \ |
| 457 | 'path_info: project' \ |
| 458 | 'gitweb_run "" "/.git"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 459 | |
| 460 | test_expect_success \ |
| 461 | 'path_info: project/branch' \ |
| 462 | 'gitweb_run "" "/.git/b"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 463 | |
| 464 | test_expect_success \ |
| 465 | 'path_info: project/branch:file' \ |
| 466 | 'gitweb_run "" "/.git/master:file"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 467 | |
| 468 | test_expect_success \ |
| 469 | 'path_info: project/branch:dir/' \ |
| 470 | 'gitweb_run "" "/.git/master:foo/"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 471 | |
| 472 | test_expect_success \ |
Jakub Narebski | 18ab83e | 2012-01-07 11:47:38 +0100 | [diff] [blame] | 473 | 'path_info: project/branch (non-existent)' \ |
| 474 | 'gitweb_run "" "/.git/non-existent"' |
| 475 | |
| 476 | test_expect_success \ |
| 477 | 'path_info: project/branch:filename (non-existent branch)' \ |
| 478 | 'gitweb_run "" "/.git/non-existent:non-existent"' |
| 479 | |
| 480 | test_expect_success \ |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 481 | 'path_info: project/branch:file (non-existent)' \ |
| 482 | 'gitweb_run "" "/.git/master:non-existent"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 483 | |
| 484 | test_expect_success \ |
| 485 | 'path_info: project/branch:dir/ (non-existent)' \ |
| 486 | 'gitweb_run "" "/.git/master:non-existent/"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 487 | |
| 488 | |
| 489 | test_expect_success \ |
| 490 | 'path_info: project/branch:/file' \ |
| 491 | 'gitweb_run "" "/.git/master:/file"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 492 | |
| 493 | test_expect_success \ |
| 494 | 'path_info: project/:/file (implicit HEAD)' \ |
| 495 | 'gitweb_run "" "/.git/:/file"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 496 | |
| 497 | test_expect_success \ |
| 498 | 'path_info: project/:/ (implicit HEAD, top tree)' \ |
| 499 | 'gitweb_run "" "/.git/:/"' |
Jakub Narebski | 9a1fd65 | 2008-10-02 16:52:20 +0200 | [diff] [blame] | 500 | |
| 501 | |
| 502 | # ---------------------------------------------------------------------- |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 503 | # feed generation |
| 504 | |
| 505 | test_expect_success \ |
| 506 | 'feeds: OPML' \ |
| 507 | 'gitweb_run "a=opml"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 508 | |
| 509 | test_expect_success \ |
| 510 | 'feed: RSS' \ |
| 511 | 'gitweb_run "p=.git;a=rss"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 512 | |
| 513 | test_expect_success \ |
| 514 | 'feed: Atom' \ |
| 515 | 'gitweb_run "p=.git;a=atom"' |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 516 | |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 517 | # ---------------------------------------------------------------------- |
| 518 | # encoding/decoding |
| 519 | |
| 520 | test_expect_success \ |
| 521 | 'encode(commit): utf8' \ |
Junio C Hamano | bfdbee9 | 2008-08-08 02:26:28 -0700 | [diff] [blame] | 522 | '. "$TEST_DIRECTORY"/t3901-utf8.txt && |
Jakub Narebski | e5ea66f | 2011-02-27 17:58:32 +0100 | [diff] [blame] | 523 | test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" && |
| 524 | test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" && |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 525 | echo "UTF-8" >> file && |
| 526 | git add file && |
Junio C Hamano | bfdbee9 | 2008-08-08 02:26:28 -0700 | [diff] [blame] | 527 | git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt && |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 528 | gitweb_run "p=.git;a=commit"' |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 529 | |
| 530 | test_expect_success \ |
| 531 | 'encode(commit): iso-8859-1' \ |
Junio C Hamano | bfdbee9 | 2008-08-08 02:26:28 -0700 | [diff] [blame] | 532 | '. "$TEST_DIRECTORY"/t3901-8859-1.txt && |
Jakub Narebski | e5ea66f | 2011-02-27 17:58:32 +0100 | [diff] [blame] | 533 | test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" && |
| 534 | test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" && |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 535 | echo "ISO-8859-1" >> file && |
| 536 | git add file && |
Yann Droneaud | 5d76ef2 | 2013-03-24 22:06:13 +0100 | [diff] [blame] | 537 | test_config i18n.commitencoding ISO-8859-1 && |
Brandon Casey | 5ae93df | 2009-05-18 18:44:38 -0500 | [diff] [blame] | 538 | git commit -F "$TEST_DIRECTORY"/t3900/ISO8859-1.txt && |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 539 | gitweb_run "p=.git;a=commit"' |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 540 | |
| 541 | test_expect_success \ |
| 542 | 'encode(log): utf-8 and iso-8859-1' \ |
| 543 | 'gitweb_run "p=.git;a=log"' |
Martin Koegler | 00f429a | 2007-06-03 17:42:44 +0200 | [diff] [blame] | 544 | |
Jakub Narebski | 1207510 | 2007-07-28 16:27:32 +0200 | [diff] [blame] | 545 | # ---------------------------------------------------------------------- |
| 546 | # extra options |
| 547 | |
| 548 | test_expect_success \ |
| 549 | 'opt: log --no-merges' \ |
| 550 | 'gitweb_run "p=.git;a=log;opt=--no-merges"' |
Jakub Narebski | 1207510 | 2007-07-28 16:27:32 +0200 | [diff] [blame] | 551 | |
| 552 | test_expect_success \ |
| 553 | 'opt: atom --no-merges' \ |
| 554 | 'gitweb_run "p=.git;a=log;opt=--no-merges"' |
Jakub Narebski | 1207510 | 2007-07-28 16:27:32 +0200 | [diff] [blame] | 555 | |
| 556 | test_expect_success \ |
| 557 | 'opt: "file" history --no-merges' \ |
| 558 | 'gitweb_run "p=.git;a=history;f=file;opt=--no-merges"' |
Jakub Narebski | 1207510 | 2007-07-28 16:27:32 +0200 | [diff] [blame] | 559 | |
| 560 | test_expect_success \ |
| 561 | 'opt: log --no-such-option (invalid option)' \ |
| 562 | 'gitweb_run "p=.git;a=log;opt=--no-such-option"' |
Jakub Narebski | 1207510 | 2007-07-28 16:27:32 +0200 | [diff] [blame] | 563 | |
| 564 | test_expect_success \ |
| 565 | 'opt: tree --no-merges (invalid option for action)' \ |
| 566 | 'gitweb_run "p=.git;a=tree;opt=--no-merges"' |
Jakub Narebski | 1207510 | 2007-07-28 16:27:32 +0200 | [diff] [blame] | 567 | |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 568 | # ---------------------------------------------------------------------- |
Petr Baudis | bc8b95a | 2007-12-08 12:30:59 +0100 | [diff] [blame] | 569 | # testing config_to_multi / cloneurl |
| 570 | |
| 571 | test_expect_success \ |
| 572 | 'URL: no project URLs, no base URL' \ |
| 573 | 'gitweb_run "p=.git;a=summary"' |
Petr Baudis | bc8b95a | 2007-12-08 12:30:59 +0100 | [diff] [blame] | 574 | |
| 575 | test_expect_success \ |
| 576 | 'URL: project URLs via gitweb.url' \ |
| 577 | 'git config --add gitweb.url git://example.com/git/trash.git && |
| 578 | git config --add gitweb.url http://example.com/git/trash.git && |
| 579 | gitweb_run "p=.git;a=summary"' |
Petr Baudis | bc8b95a | 2007-12-08 12:30:59 +0100 | [diff] [blame] | 580 | |
| 581 | cat >.git/cloneurl <<\EOF |
| 582 | git://example.com/git/trash.git |
| 583 | http://example.com/git/trash.git |
| 584 | EOF |
| 585 | |
| 586 | test_expect_success \ |
| 587 | 'URL: project URLs via cloneurl file' \ |
| 588 | 'gitweb_run "p=.git;a=summary"' |
Petr Baudis | bc8b95a | 2007-12-08 12:30:59 +0100 | [diff] [blame] | 589 | |
| 590 | # ---------------------------------------------------------------------- |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 591 | # gitweb config and repo config |
| 592 | |
Jakub Narebski | 9be3614 | 2010-03-01 22:51:34 +0100 | [diff] [blame] | 593 | cat >>gitweb_config.perl <<\EOF |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 594 | |
Jakub Narebski | 9be3614 | 2010-03-01 22:51:34 +0100 | [diff] [blame] | 595 | # turn on override for each overridable feature |
| 596 | foreach my $key (keys %feature) { |
| 597 | if ($feature{$key}{'sub'}) { |
| 598 | $feature{$key}{'override'} = 1; |
| 599 | } |
| 600 | } |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 601 | EOF |
| 602 | |
| 603 | test_expect_success \ |
Jakub Narebski | 9be3614 | 2010-03-01 22:51:34 +0100 | [diff] [blame] | 604 | 'config override: projects list (implicit)' \ |
| 605 | 'gitweb_run' |
Jakub Narebski | 9be3614 | 2010-03-01 22:51:34 +0100 | [diff] [blame] | 606 | |
| 607 | test_expect_success \ |
Marcel M. Cary | df5d10a | 2009-02-18 14:09:41 +0100 | [diff] [blame] | 608 | 'config override: tree view, features not overridden in repo config' \ |
| 609 | 'gitweb_run "p=.git;a=tree"' |
Marcel M. Cary | df5d10a | 2009-02-18 14:09:41 +0100 | [diff] [blame] | 610 | |
| 611 | test_expect_success \ |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 612 | 'config override: tree view, features disabled in repo config' \ |
| 613 | 'git config gitweb.blame no && |
| 614 | git config gitweb.snapshot none && |
Giuseppe Bilotta | e9fdd74 | 2009-06-30 00:00:51 +0200 | [diff] [blame] | 615 | git config gitweb.avatar gravatar && |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 616 | gitweb_run "p=.git;a=tree"' |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 617 | |
| 618 | test_expect_success \ |
Marcel M. Cary | df5d10a | 2009-02-18 14:09:41 +0100 | [diff] [blame] | 619 | 'config override: tree view, features enabled in repo config (1)' \ |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 620 | 'git config gitweb.blame yes && |
| 621 | git config gitweb.snapshot "zip,tgz, tbz2" && |
| 622 | gitweb_run "p=.git;a=tree"' |
Jakub Narebski | e9c34c2 | 2007-11-03 00:41:18 +0100 | [diff] [blame] | 623 | |
Marcel M. Cary | df5d10a | 2009-02-18 14:09:41 +0100 | [diff] [blame] | 624 | cat >.git/config <<\EOF |
| 625 | # testing noval and alternate separator |
| 626 | [gitweb] |
| 627 | blame |
| 628 | snapshot = zip tgz |
| 629 | EOF |
| 630 | test_expect_success \ |
| 631 | 'config override: tree view, features enabled in repo config (2)' \ |
| 632 | 'gitweb_run "p=.git;a=tree"' |
Marcel M. Cary | df5d10a | 2009-02-18 14:09:41 +0100 | [diff] [blame] | 633 | |
Jakub Narebski | 4586864 | 2008-12-08 14:13:21 +0100 | [diff] [blame] | 634 | # ---------------------------------------------------------------------- |
Jakub Narebski | fc8fcd2 | 2012-02-15 17:37:06 +0100 | [diff] [blame] | 635 | # searching |
| 636 | |
| 637 | cat >>gitweb_config.perl <<\EOF |
| 638 | |
| 639 | # enable search |
| 640 | $feature{'search'}{'default'} = [1]; |
| 641 | $feature{'grep'}{'default'} = [1]; |
| 642 | $feature{'pickaxe'}{'default'} = [1]; |
| 643 | EOF |
| 644 | |
| 645 | test_expect_success \ |
| 646 | 'search: preparation' \ |
| 647 | 'echo "1st MATCH" >>file && |
| 648 | echo "2nd MATCH" >>file && |
| 649 | echo "MATCH" >>bar && |
| 650 | git add file bar && |
| 651 | git commit -m "Added MATCH word"' |
| 652 | |
| 653 | test_expect_success \ |
| 654 | 'search: commit author' \ |
| 655 | 'gitweb_run "p=.git;a=search;h=HEAD;st=author;s=A+U+Thor"' |
| 656 | |
| 657 | test_expect_success \ |
| 658 | 'search: commit message' \ |
| 659 | 'gitweb_run "p=.git;a=search;h=HEAD;st=commitr;s=MATCH"' |
| 660 | |
| 661 | test_expect_success \ |
| 662 | 'search: grep' \ |
| 663 | 'gitweb_run "p=.git;a=search;h=HEAD;st=grep;s=MATCH"' |
| 664 | |
| 665 | test_expect_success \ |
| 666 | 'search: pickaxe' \ |
| 667 | 'gitweb_run "p=.git;a=search;h=HEAD;st=pickaxe;s=MATCH"' |
| 668 | |
| 669 | test_expect_success \ |
| 670 | 'search: projects' \ |
| 671 | 'gitweb_run "a=project_list;s=.git"' |
| 672 | |
| 673 | # ---------------------------------------------------------------------- |
Jakub Narebski | 4586864 | 2008-12-08 14:13:21 +0100 | [diff] [blame] | 674 | # non-ASCII in README.html |
| 675 | |
| 676 | test_expect_success \ |
| 677 | 'README.html with non-ASCII characters (utf-8)' \ |
| 678 | 'echo "<b>UTF-8 example:</b><br />" > .git/README.html && |
| 679 | cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html && |
| 680 | gitweb_run "p=.git;a=summary"' |
Jakub Narebski | 4586864 | 2008-12-08 14:13:21 +0100 | [diff] [blame] | 681 | |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 682 | # ---------------------------------------------------------------------- |
| 683 | # syntax highlighting |
| 684 | |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 685 | |
Ramsay Jones | 7202db8 | 2013-10-06 21:50:46 +0100 | [diff] [blame] | 686 | highlight_version=$(highlight --version </dev/null 2>/dev/null) |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 687 | if [ $? -eq 127 ]; then |
Ramsay Jones | 7202db8 | 2013-10-06 21:50:46 +0100 | [diff] [blame] | 688 | say "Skipping syntax highlighting tests: 'highlight' not found" |
| 689 | elif test -z "$highlight_version"; then |
| 690 | say "Skipping syntax highlighting tests: incorrect 'highlight' found" |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 691 | else |
| 692 | test_set_prereq HIGHLIGHT |
Jakub Narebski | ae5e97e | 2010-10-13 13:57:41 +0200 | [diff] [blame] | 693 | cat >>gitweb_config.perl <<-\EOF |
| 694 | our $highlight_bin = "highlight"; |
| 695 | $feature{'highlight'}{'override'} = 1; |
| 696 | EOF |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 697 | fi |
| 698 | |
| 699 | test_expect_success HIGHLIGHT \ |
Jakub Narebski | ae5e97e | 2010-10-13 13:57:41 +0200 | [diff] [blame] | 700 | 'syntax highlighting (no highlight, unknown syntax)' \ |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 701 | 'git config gitweb.highlight yes && |
| 702 | gitweb_run "p=.git;a=blob;f=file"' |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 703 | |
| 704 | test_expect_success HIGHLIGHT \ |
Jakub Narebski | ae5e97e | 2010-10-13 13:57:41 +0200 | [diff] [blame] | 705 | 'syntax highlighting (highlighted, shell script)' \ |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 706 | 'git config gitweb.highlight yes && |
| 707 | echo "#!/usr/bin/sh" > test.sh && |
| 708 | git add test.sh && |
| 709 | git commit -m "Add test.sh" && |
| 710 | gitweb_run "p=.git;a=blob;f=test.sh"' |
Jakub Narebski | 592ea41 | 2010-04-27 21:34:45 +0200 | [diff] [blame] | 711 | |
Jakub Narebski | 12b1443 | 2011-04-29 19:51:56 +0200 | [diff] [blame] | 712 | # ---------------------------------------------------------------------- |
| 713 | # forks of projects |
| 714 | |
| 715 | cat >>gitweb_config.perl <<\EOF && |
| 716 | $feature{'forks'}{'default'} = [1]; |
| 717 | EOF |
| 718 | |
| 719 | test_expect_success \ |
| 720 | 'forks: prepare' \ |
| 721 | 'git init --bare foo.git && |
| 722 | git --git-dir=foo.git --work-tree=. add file && |
| 723 | git --git-dir=foo.git --work-tree=. commit -m "Initial commit" && |
| 724 | echo "foo" > foo.git/description && |
| 725 | mkdir -p foo && |
| 726 | (cd foo && |
| 727 | git clone --shared --bare ../foo.git foo-forked.git && |
| 728 | echo "fork of foo" > foo-forked.git/description)' |
| 729 | |
| 730 | test_expect_success \ |
| 731 | 'forks: projects list' \ |
| 732 | 'gitweb_run' |
| 733 | |
| 734 | test_expect_success \ |
| 735 | 'forks: forks action' \ |
| 736 | 'gitweb_run "p=foo.git;a=forks"' |
| 737 | |
| 738 | # ---------------------------------------------------------------------- |
| 739 | # content tags (tag cloud) |
| 740 | |
| 741 | cat >>gitweb_config.perl <<-\EOF && |
| 742 | # we don't test _setting_ content tags, so any true value is good |
| 743 | $feature{'ctags'}{'default'} = ['ctags_script.cgi']; |
| 744 | EOF |
| 745 | |
| 746 | test_expect_success \ |
| 747 | 'ctags: tag cloud in projects list' \ |
| 748 | 'mkdir .git/ctags && |
| 749 | echo "2" > .git/ctags/foo && |
| 750 | echo "1" > .git/ctags/bar && |
| 751 | gitweb_run' |
| 752 | |
| 753 | test_expect_success \ |
| 754 | 'ctags: search projects by existing tag' \ |
| 755 | 'gitweb_run "by_tag=foo"' |
| 756 | |
| 757 | test_expect_success \ |
| 758 | 'ctags: search projects by non existent tag' \ |
| 759 | 'gitweb_run "by_tag=non-existent"' |
| 760 | |
Jonathan Nieder | 2c162b5 | 2011-06-09 02:08:57 -0500 | [diff] [blame] | 761 | test_expect_success \ |
| 762 | 'ctags: malformed tag weights' \ |
| 763 | 'mkdir -p .git/ctags && |
| 764 | echo "not-a-number" > .git/ctags/nan && |
| 765 | echo "not-a-number-2" > .git/ctags/nan2 && |
| 766 | echo "0.1" >.git/ctags/floating-point && |
| 767 | gitweb_run' |
| 768 | |
Sebastien Cevey | d940c90 | 2011-04-29 19:52:01 +0200 | [diff] [blame] | 769 | # ---------------------------------------------------------------------- |
| 770 | # categories |
| 771 | |
| 772 | test_expect_success \ |
| 773 | 'categories: projects list, only default category' \ |
| 774 | 'echo "\$projects_list_group_categories = 1;" >>gitweb_config.perl && |
| 775 | gitweb_run' |
| 776 | |
Jakub Narebski | fd49e56 | 2012-02-15 16:36:41 +0100 | [diff] [blame] | 777 | # ---------------------------------------------------------------------- |
| 778 | # unborn branches |
| 779 | |
| 780 | test_expect_success \ |
| 781 | 'unborn HEAD: "summary" page (with "heads" subview)' \ |
Jeff King | a6a4a88 | 2015-03-20 06:10:21 -0400 | [diff] [blame] | 782 | '{ |
| 783 | git checkout orphan_branch || |
| 784 | git checkout --orphan orphan_branch |
| 785 | } && |
Jakub Narebski | fd49e56 | 2012-02-15 16:36:41 +0100 | [diff] [blame] | 786 | test_when_finished "git checkout master" && |
| 787 | gitweb_run "p=.git;a=summary"' |
| 788 | |
Jakub Narebski | 77e4e8b | 2007-05-19 02:19:20 +0200 | [diff] [blame] | 789 | test_done |