summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-12 02:29:29 -0700
committerUnknwon <u@gogs.io>2016-08-14 23:52:24 -0700
commit15845cb28763c1542556ad61d2aa9735541dbf45 (patch)
tree94b2053202fcf5270e0697fc37c38203310571ed /models
parentd0a0239bacf02eb004634dfe1bb0a3f7dfe5adb6 (diff)
downloadgitea-15845cb28763c1542556ad61d2aa9735541dbf45.tar.gz
gitea-15845cb28763c1542556ad61d2aa9735541dbf45.zip
Code clean up for new config options
Diffstat (limited to 'models')
-rw-r--r--models/error.go4
-rw-r--r--models/issue.go4
-rw-r--r--models/repo.go2
-rw-r--r--models/ssh_key_test.go2
-rw-r--r--models/update.go24
5 files changed, 20 insertions, 16 deletions
diff --git a/models/error.go b/models/error.go
index e608677028..89c6389b0d 100644
--- a/models/error.go
+++ b/models/error.go
@@ -427,7 +427,7 @@ func IsErrRepoFileAlreadyExist(err error) bool {
}
func (err ErrRepoFileAlreadyExist) Error() string {
- return fmt.Sprintf("repository file already exists [file name: %s]", err.FileName)
+ return fmt.Sprintf("repository file already exists [file_name: %s]", err.FileName)
}
// __________ .__
@@ -663,5 +663,5 @@ func IsErrUploadNotExist(err error) bool {
}
func (err ErrUploadNotExist) Error() string {
- return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
+ return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s, user_id: %d, repo_id: %d]", err.ID, err.UUID, err.UserID, err.RepoID)
}
diff --git a/models/issue.go b/models/issue.go
index e0b72952eb..eb126325f0 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -645,12 +645,12 @@ func newIssue(e *xorm.Session, repo *Repository, issue *Issue, labelIDs []int64,
if IsErrAttachmentNotExist(err) {
continue
}
- return fmt.Errorf("getAttachmentByUUID[%s]: %v", uuid, err)
+ return fmt.Errorf("getAttachmentByUUID [%s]: %v", uuid, err)
}
attachment.IssueID = issue.ID
// No assign value could be 0, so ignore AllCols().
if _, err = e.Id(attachment.ID).Update(attachment); err != nil {
- return fmt.Errorf("update attachment[%d]: %v", attachment.ID, err)
+ return fmt.Errorf("update attachment [%d]: %v", attachment.ID, err)
}
}
diff --git a/models/repo.go b/models/repo.go
index c2ed6e012e..9e20b9fb25 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -2557,7 +2557,7 @@ func (u *Upload) AfterSet(colName string, _ xorm.Cell) {
// UploadLocalPath returns where uploads is stored in local file system based on given UUID.
func UploadLocalPath(uuid string) string {
- return path.Join(setting.UploadTempPath, uuid[0:1], uuid[1:2], uuid)
+ return path.Join(setting.Repository.Upload.TempPath, uuid[0:1], uuid[1:2], uuid)
}
// LocalPath returns where uploads are temporarily stored in local file system.
diff --git a/models/ssh_key_test.go b/models/ssh_key_test.go
index 2f7a572c44..1cda60c508 100644
--- a/models/ssh_key_test.go
+++ b/models/ssh_key_test.go
@@ -29,7 +29,7 @@ func Test_SSHParsePublicKey(t *testing.T) {
"rsa-2048": {"rsa", 2048, "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMZXh+1OBUwSH9D45wTaxErQIN9IoC9xl7MKJkqvTvv6O5RR9YW/IK9FbfjXgXsppYGhsCZo1hFOOsXHMnfOORqu/xMDx4yPuyvKpw4LePEcg4TDipaDFuxbWOqc/BUZRZcXu41QAWfDLrInwsltWZHSeG7hjhpacl4FrVv9V1pS6Oc5Q1NxxEzTzuNLS/8diZrTm/YAQQ/+B+mzWI3zEtF4miZjjAljWd1LTBPvU23d29DcBmmFahcZ441XZsTeAwGxG/Q6j8NgNXj9WxMeWwxXV2jeAX/EBSpZrCVlCQ1yJswT6xCp8TuBnTiGWYMBNTbOZvPC4e0WI2/yZW/s5F nocomment"},
"ecdsa-256": {"ecdsa", 256, "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFQacN3PrOll7PXmN5B/ZNVahiUIqI05nbBlZk1KXsO3d06ktAWqbNflv2vEmA38bTFTfJ2sbn2B5ksT52cDDbA= nocomment"},
"ecdsa-384": {"ecdsa", 384, "ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBINmioV+XRX1Fm9Qk2ehHXJ2tfVxW30ypUWZw670Zyq5GQfBAH6xjygRsJ5wWsHXBsGYgFUXIHvMKVAG1tpw7s6ax9oA+dJOJ7tj+vhn8joFqT+sg3LYHgZkHrfqryRasQ== nocomment"},
- "ecdsa-521": {"ecdsa", 521, "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBACGt3UG3EzRwNOI17QR84l6PgiAcvCE7v6aXPj/SC6UWKg4EL8vW9ZBcdYL9wzs4FZXh4MOV8jAzu3KRWNTwb4k2wFNUpGOt7l28MztFFEtH5BDDrtAJSPENPy8pvPLMfnPg5NhvWycqIBzNcHipem5wSJFN5PdpNOC2xMrPWKNqj+ZjQ== nocomment"},
+ // "ecdsa-521": {"ecdsa", 521, "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBACGt3UG3EzRwNOI17QR84l6PgiAcvCE7v6aXPj/SC6UWKg4EL8vW9ZBcdYL9wzs4FZXh4MOV8jAzu3KRWNTwb4k2wFNUpGOt7l28MztFFEtH5BDDrtAJSPENPy8pvPLMfnPg5NhvWycqIBzNcHipem5wSJFN5PdpNOC2xMrPWKNqj+ZjQ== nocomment"},
}
Convey("Parse public keys in both native and ssh-keygen", t, func() {
diff --git a/models/update.go b/models/update.go
index be50a15e5a..952794538a 100644
--- a/models/update.go
+++ b/models/update.go
@@ -47,6 +47,19 @@ func DeleteUpdateTaskByUUID(uuid string) error {
return err
}
+// CommitToPushCommit transforms a git.Commit to PushCommit type.
+func CommitToPushCommit(commit *git.Commit) *PushCommit {
+ return &PushCommit{
+ Sha1: commit.ID.String(),
+ Message: commit.Message(),
+ AuthorEmail: commit.Author.Email,
+ AuthorName: commit.Author.Name,
+ CommitterEmail: commit.Committer.Email,
+ CommitterName: commit.Committer.Name,
+ Timestamp: commit.Author.When,
+ }
+}
+
func ListToPushCommits(l *list.List) *PushCommits {
commits := make([]*PushCommit, 0)
var actEmail string
@@ -55,16 +68,7 @@ func ListToPushCommits(l *list.List) *PushCommits {
if actEmail == "" {
actEmail = commit.Committer.Email
}
- commits = append(commits,
- &PushCommit{
- Sha1: commit.ID.String(),
- Message: commit.Message(),
- AuthorEmail: commit.Author.Email,
- AuthorName: commit.Author.Name,
- CommitterEmail: commit.Committer.Email,
- CommitterName: commit.Committer.Name,
- Timestamp: commit.Author.When,
- })
+ commits = append(commits, CommitToPushCommit(commit))
}
return &PushCommits{l.Len(), commits, "", nil}
}