Code

spec: add missing build dependency
[git.git] / t / t9502-gitweb-standalone-parse-output.sh
index dd8389000187b11fe126f6ca76f578324075bd6f..731e64c3adbd4d887bfa2c96eb060aa890377cfc 100755 (executable)
@@ -112,4 +112,78 @@ test_expect_success 'snapshot: hierarchical branch name (xx/test)' '
 '
 test_debug 'cat gitweb.headers'
 
+# ----------------------------------------------------------------------
+# forks of projects
+
+test_expect_success 'forks: setup' '
+       git init --bare foo.git &&
+       echo file > file &&
+       git --git-dir=foo.git --work-tree=. add file &&
+       git --git-dir=foo.git --work-tree=. commit -m "Initial commit" &&
+       echo "foo" > foo.git/description &&
+       git clone --bare foo.git foo.bar.git &&
+       echo "foo.bar" > foo.bar.git/description &&
+       git clone --bare foo.git foo_baz.git &&
+       echo "foo_baz" > foo_baz.git/description &&
+       rm -fr   foo &&
+       mkdir -p foo &&
+       (
+               cd foo &&
+               git clone --shared --bare ../foo.git foo-forked.git &&
+               echo "fork of foo" > foo-forked.git/description
+       )
+'
+
+test_expect_success 'forks: not skipped unless "forks" feature enabled' '
+       gitweb_run "a=project_list" &&
+       grep -q ">\\.git<"               gitweb.body &&
+       grep -q ">foo\\.git<"            gitweb.body &&
+       grep -q ">foo_baz\\.git<"        gitweb.body &&
+       grep -q ">foo\\.bar\\.git<"      gitweb.body &&
+       grep -q ">foo_baz\\.git<"        gitweb.body &&
+       grep -q ">foo/foo-forked\\.git<" gitweb.body &&
+       grep -q ">fork of .*<"           gitweb.body
+'
+
+cat >>gitweb_config.perl <<\EOF &&
+$feature{'forks'}{'default'} = [1];
+EOF
+
+test_expect_success 'forks: forks skipped if "forks" feature enabled' '
+       gitweb_run "a=project_list" &&
+       grep -q ">\\.git<"               gitweb.body &&
+       grep -q ">foo\\.git<"            gitweb.body &&
+       grep -q ">foo_baz\\.git<"        gitweb.body &&
+       grep -q ">foo\\.bar\\.git<"      gitweb.body &&
+       grep -q ">foo_baz\\.git<"        gitweb.body &&
+       grep -v ">foo/foo-forked\\.git<" gitweb.body &&
+       grep -v ">fork of .*<"           gitweb.body
+'
+
+test_expect_success 'forks: "forks" action for forked repository' '
+       gitweb_run "p=foo.git;a=forks" &&
+       grep -q ">foo/foo-forked\\.git<" gitweb.body &&
+       grep -q ">fork of foo<"          gitweb.body
+'
+
+test_expect_success 'forks: can access forked repository' '
+       gitweb_run "p=foo/foo-forked.git;a=summary" &&
+       grep -q "200 OK"        gitweb.headers &&
+       grep -q ">fork of foo<" gitweb.body
+'
+
+test_expect_success 'forks: project_index lists all projects (incl. forks)' '
+       cat >expected <<-\EOF
+       .git
+       foo.bar.git
+       foo.git
+       foo/foo-forked.git
+       foo_baz.git
+       EOF
+       gitweb_run "a=project_index" &&
+       sed -e "s/ .*//" <gitweb.body | sort >actual &&
+       test_cmp expected actual
+'
+
+
 test_done