mirror of https://github.com/go-gitea/gitea
parent
6398ca745a
commit
36a2d2f919
@ -0,0 +1 @@ |
||||
ref: refs/heads/master |
@ -0,0 +1,6 @@ |
||||
[core] |
||||
repositoryformatversion = 0 |
||||
filemode = true |
||||
bare = true |
||||
ignorecase = true |
||||
precomposeunicode = true |
@ -0,0 +1 @@ |
||||
The repository will be used to test third-party renderer in TestExternalMarkupRenderer |
@ -0,0 +1,15 @@ |
||||
#!/usr/bin/env bash |
||||
data=$(cat) |
||||
exitcodes="" |
||||
hookname=$(basename $0) |
||||
GIT_DIR=${GIT_DIR:-$(dirname $0)} |
||||
|
||||
for hook in ${GIT_DIR}/hooks/${hookname}.d/*; do |
||||
test -x "${hook}" && test -f "${hook}" || continue |
||||
echo "${data}" | "${hook}" |
||||
exitcodes="${exitcodes} $?" |
||||
done |
||||
|
||||
for i in ${exitcodes}; do |
||||
[ ${i} -eq 0 ] || exit ${i} |
||||
done |
@ -0,0 +1,2 @@ |
||||
#!/usr/bin/env bash |
||||
"$GITEA_ROOT/gitea" hook --config="$GITEA_ROOT/$GITEA_CONF" post-receive |
@ -0,0 +1,15 @@ |
||||
#!/usr/bin/env bash |
||||
data=$(cat) |
||||
exitcodes="" |
||||
hookname=$(basename $0) |
||||
GIT_DIR=${GIT_DIR:-$(dirname $0)} |
||||
|
||||
for hook in ${GIT_DIR}/hooks/${hookname}.d/*; do |
||||
test -x "${hook}" && test -f "${hook}" || continue |
||||
echo "${data}" | "${hook}" |
||||
exitcodes="${exitcodes} $?" |
||||
done |
||||
|
||||
for i in ${exitcodes}; do |
||||
[ ${i} -eq 0 ] || exit ${i} |
||||
done |
@ -0,0 +1,2 @@ |
||||
#!/usr/bin/env bash |
||||
"$GITEA_ROOT/gitea" hook --config="$GITEA_ROOT/$GITEA_CONF" pre-receive |
@ -0,0 +1,14 @@ |
||||
#!/usr/bin/env bash |
||||
exitcodes="" |
||||
hookname=$(basename $0) |
||||
GIT_DIR=${GIT_DIR:-$(dirname $0)} |
||||
|
||||
for hook in ${GIT_DIR}/hooks/${hookname}.d/*; do |
||||
test -x "${hook}" && test -f "${hook}" || continue |
||||
"${hook}" $1 $2 $3 |
||||
exitcodes="${exitcodes} $?" |
||||
done |
||||
|
||||
for i in ${exitcodes}; do |
||||
[ ${i} -eq 0 ] || exit ${i} |
||||
done |
@ -0,0 +1,2 @@ |
||||
#!/usr/bin/env bash |
||||
"$GITEA_ROOT/gitea" hook --config="$GITEA_ROOT/$GITEA_CONF" update $1 $2 $3 |
@ -0,0 +1,6 @@ |
||||
# git ls-files --others --exclude-from=.git/info/exclude |
||||
# Lines that start with '#' are comments. |
||||
# For a project mostly in C, the following would be a good set of |
||||
# exclude patterns (uncomment them if you want to use them): |
||||
# *.[oa] |
||||
# *~ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@ |
||||
# pack-refs with: peeled fully-peeled sorted |
||||
c961cc4d1ba6b7ee1ba228a9a02b00b7746d8033 refs/heads/master |
@ -0,0 +1,40 @@ |
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration |
||||
|
||||
import ( |
||||
"bytes" |
||||
"io" |
||||
"net/http" |
||||
"strings" |
||||
"testing" |
||||
|
||||
"code.gitea.io/gitea/modules/setting" |
||||
"code.gitea.io/gitea/tests" |
||||
|
||||
"github.com/stretchr/testify/assert" |
||||
) |
||||
|
||||
func TestExternalMarkupRenderer(t *testing.T) { |
||||
defer tests.PrepareTestEnv(t)() |
||||
if !setting.Database.UseSQLite3 { |
||||
t.Skip() |
||||
return |
||||
} |
||||
|
||||
const repoURL = "user30/renderer" |
||||
req := NewRequest(t, "GET", repoURL+"/src/branch/master/README.html") |
||||
resp := MakeRequest(t, req, http.StatusOK) |
||||
assert.EqualValues(t, "text/html; charset=UTF-8", resp.Header()["Content-Type"][0]) |
||||
|
||||
bs, err := io.ReadAll(resp.Body) |
||||
assert.NoError(t, err) |
||||
|
||||
doc := NewHTMLParser(t, bytes.NewBuffer(bs)) |
||||
div := doc.Find("div.file-view") |
||||
data, err := div.Html() |
||||
assert.NoError(t, err) |
||||
assert.EqualValues(t, "<div>\n\ttest external renderer\n</div>", strings.TrimSpace(data)) |
||||
} |
@ -0,0 +1,23 @@ |
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// gobuild: external_renderer
|
||||
|
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
"io" |
||||
"os" |
||||
) |
||||
|
||||
func main() { |
||||
if len(os.Args) > 1 { |
||||
fmt.Print(os.Args[1]) |
||||
} else { |
||||
_, err := io.Copy(os.Stdout, os.Stdin) |
||||
if err != nil { |
||||
fmt.Println(err) |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue