Skip to content

Commit

Permalink
Merge branch 'master' into doctor-check-fix-db-consistency_10280
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed May 21, 2020
2 parents 2f7ba56 + 0b8b81e commit 44d33cb
Show file tree
Hide file tree
Showing 110 changed files with 3,776 additions and 1,151 deletions.
15 changes: 3 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# http:https://editorconfig.org
root = true

[*]
Expand All @@ -10,23 +9,15 @@ end_of_line = lf
[*.md]
trim_trailing_whitespace = false

[*.go]
indent_style = tab
indent_size = 8

[*.{tmpl,html}]
[*.{go,tmpl,html}]
indent_style = tab
indent_size = 4

[*.less]
[*.{less,css}]
indent_style = space
indent_size = 4

[*.{yml,json}]
indent_style = space
indent_size = 2

[*.js]
[*.{js,json,yml}]
indent_style = space
indent_size = 2

Expand Down
1 change: 1 addition & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ rules:
number-leading-zero: never
rule-empty-line-before: null
selector-pseudo-element-colon-notation: null
shorthand-property-no-redundant-values: true
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ Mura Li <[email protected]> (@typeless)
6543 <[email protected]> (@6543)
jaqra <[email protected]> (@jaqra)
David Svantesson <[email protected]> (@davidsvantesson)
CirnoT <[email protected]> (@CirnoT)
23 changes: 20 additions & 3 deletions cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ package cmd

import (
"fmt"
"os"

"code.gitea.io/gitea/modules/generate"

"github.com/mattn/go-isatty"
"github.com/urfave/cli"
)

Expand Down Expand Up @@ -59,7 +61,12 @@ func runGenerateInternalToken(c *cli.Context) error {
return err
}

fmt.Printf("%s\n", internalToken)
fmt.Printf("%s", internalToken)

if isatty.IsTerminal(os.Stdout.Fd()) {
fmt.Printf("\n")
}

return nil
}

Expand All @@ -69,7 +76,12 @@ func runGenerateLfsJwtSecret(c *cli.Context) error {
return err
}

fmt.Printf("%s\n", JWTSecretBase64)
fmt.Printf("%s", JWTSecretBase64)

if isatty.IsTerminal(os.Stdout.Fd()) {
fmt.Printf("\n")
}

return nil
}

Expand All @@ -79,6 +91,11 @@ func runGenerateSecretKey(c *cli.Context) error {
return err
}

fmt.Printf("%s\n", secretKey)
fmt.Printf("%s", secretKey)

if isatty.IsTerminal(os.Stdout.Fd()) {
fmt.Printf("\n")
}

return nil
}
4 changes: 2 additions & 2 deletions docs/content/doc/features/authentication.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ Before activating SSPI single sign-on authentication (SSO) you have to prepare y

- Sign in to a client computer in the same domain with any domain user (client computer, different from the server running `gitea.exe`)

- If you are using Chrome, Edge or Internet Explorer, add the URL of the web app to the Local intranet sites (`Internet Options -> Security -> Local intranet -> Sites`)
- If you are using Chrome or Edge, add the URL of the web app to the Local intranet sites (`Internet Options -> Security -> Local intranet -> Sites`)

- Start Chrome, Edge or Internet Explorer and navigate to the FQDN URL of gitea (eg. `http:https://host.domain.local:3000`)
- Start Chrome or Edge and navigate to the FQDN URL of gitea (eg. `http:https://host.domain.local:3000`)

- Click the `Sign In` button on the dashboard and choose SSPI to be automatically logged in with the same user that is currently logged on to the computer

Expand Down
11 changes: 11 additions & 0 deletions docs/content/doc/installation/from-package.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ Please follow the [deployment from binary]({{< relref "from-binary.en-us.md" >}}

Should the packages get updated and fixed, we will provide up-to-date installation instructions here.

## Alpine Linux

Alpine Linux has gitea in its community repository. It follows the latest stable version.
for more information look at https://pkgs.alpinelinux.org/packages?name=gitea&branch=edge.

install as usual:
```sh
apk add gitea
```
config is found in **/etc/gitea/app.ini**

## Windows

There are no published packages for Windows. This page will change when packages are published,
Expand Down
4 changes: 3 additions & 1 deletion docs/content/page/index.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.

## Browser Support

- Please see [Semantic UI](https://github.com/Semantic-Org/Semantic-UI#browser-support) for specific versions of supported browsers.
- Last 2 versions of Chrome, Firefox and Safari
- Firefox ESR
- Edge 14+

## Components

Expand Down
4 changes: 2 additions & 2 deletions integrations/auth_ldap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestLDAPUserSync(t *testing.T) {
}
defer prepareTestEnv(t)()
addAuthSourceLDAP(t, "")
models.SyncExternalUsers(context.Background())
models.SyncExternalUsers(context.Background(), true)

session := loginUser(t, "user1")
// Check if users exists
Expand Down Expand Up @@ -216,7 +216,7 @@ func TestLDAPUserSSHKeySync(t *testing.T) {
defer prepareTestEnv(t)()
addAuthSourceLDAP(t, "sshPublicKey")

models.SyncExternalUsers(context.Background())
models.SyncExternalUsers(context.Background(), true)

// Check if users has SSH keys synced
for _, u := range gitLDAPUsers {
Expand Down
15 changes: 10 additions & 5 deletions models/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type NoticeType int
const (
//NoticeRepository type
NoticeRepository NoticeType = iota + 1
// NoticeTask type
NoticeTask
)

// Notice represents a system notice for admin.
Expand All @@ -36,11 +38,14 @@ func (n *Notice) TrStr() string {
}

// CreateNotice creates new system notice.
func CreateNotice(tp NoticeType, desc string) error {
return createNotice(x, tp, desc)
func CreateNotice(tp NoticeType, desc string, args ...interface{}) error {
return createNotice(x, tp, desc, args...)
}

func createNotice(e Engine, tp NoticeType, desc string) error {
func createNotice(e Engine, tp NoticeType, desc string, args ...interface{}) error {
if len(args) > 0 {
desc = fmt.Sprintf(desc, args...)
}
n := &Notice{
Type: tp,
Description: desc,
Expand All @@ -50,8 +55,8 @@ func createNotice(e Engine, tp NoticeType, desc string) error {
}

// CreateRepositoryNotice creates new system notice with type NoticeRepository.
func CreateRepositoryNotice(desc string) error {
return createNotice(x, NoticeRepository, desc)
func CreateRepositoryNotice(desc string, args ...interface{}) error {
return createNotice(x, NoticeRepository, desc, args...)
}

// RemoveAllWithNotice removes all directories in given path and
Expand Down
5 changes: 2 additions & 3 deletions models/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"

Expand Down Expand Up @@ -561,11 +560,11 @@ func RemoveDeletedBranch(repoID int64, branch string) error {
}

// RemoveOldDeletedBranches removes old deleted branches
func RemoveOldDeletedBranches(ctx context.Context) {
func RemoveOldDeletedBranches(ctx context.Context, olderThan time.Duration) {
// Nothing to do for shutdown or terminate
log.Trace("Doing: DeletedBranchesCleanup")

deleteBefore := time.Now().Add(-setting.Cron.DeletedBranchesCleanup.OlderThan)
deleteBefore := time.Now().Add(-olderThan)
_, err := x.Where("deleted_unix < ?", deleteBefore.Unix()).Delete(new(DeletedBranch))
if err != nil {
log.Error("DeletedBranchesCleanup: %v", err)
Expand Down
22 changes: 22 additions & 0 deletions models/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ func (err ErrSSHDisabled) Error() string {
return "SSH is disabled"
}

// ErrCancelled represents an error due to context cancellation
type ErrCancelled struct {
Message string
}

// IsErrCancelled checks if an error is a ErrCancelled.
func IsErrCancelled(err error) bool {
_, ok := err.(ErrCancelled)
return ok
}

func (err ErrCancelled) Error() string {
return "Cancelled: " + err.Message
}

// ErrCancelledf returns an ErrCancelled for the provided format and args
func ErrCancelledf(format string, args ...interface{}) error {
return ErrCancelled{
fmt.Sprintf(format, args...),
}
}

// ____ ___
// | | \______ ___________
// | | / ___// __ \_ __ \
Expand Down
Loading

0 comments on commit 44d33cb

Please sign in to comment.