aboutsummaryrefslogtreecommitdiff
path: root/internal/db/repo_editor.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-10-23 19:15:14 +0800
committerGitHub <noreply@github.com>2022-10-23 19:15:14 +0800
commitc58c89362161718e1079b9d43c0ce984bb1506cc (patch)
tree14a54295b60b4c2887f06bfde8b7e603e0f4d6dd /internal/db/repo_editor.go
parentef0388045f8fd35a40b3404deb3caa1a37e103f7 (diff)
refactor(db): migrate password methods off `user.go` (#7205)
Diffstat (limited to 'internal/db/repo_editor.go')
-rw-r--r--internal/db/repo_editor.go39
1 files changed, 36 insertions, 3 deletions
diff --git a/internal/db/repo_editor.go b/internal/db/repo_editor.go
index 63c88b76..3edb16e2 100644
--- a/internal/db/repo_editor.go
+++ b/internal/db/repo_editor.go
@@ -183,7 +183,18 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
if err = git.Add(localPath, git.AddOptions{All: true}); err != nil {
return fmt.Errorf("git add --all: %v", err)
- } else if err = git.CreateCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
+ }
+
+ err = git.CreateCommit(
+ localPath,
+ &git.Signature{
+ Name: doer.DisplayName(),
+ Email: doer.Email,
+ When: time.Now(),
+ },
+ opts.Message,
+ )
+ if err != nil {
return fmt.Errorf("commit changes on %q: %v", localPath, err)
}
@@ -294,7 +305,18 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (
if err = git.Add(localPath, git.AddOptions{All: true}); err != nil {
return fmt.Errorf("git add --all: %v", err)
- } else if err = git.CreateCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
+ }
+
+ err = git.CreateCommit(
+ localPath,
+ &git.Signature{
+ Name: doer.DisplayName(),
+ Email: doer.Email,
+ When: time.Now(),
+ },
+ opts.Message,
+ )
+ if err != nil {
return fmt.Errorf("commit changes to %q: %v", localPath, err)
}
@@ -531,7 +553,18 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions)
if err = git.Add(localPath, git.AddOptions{All: true}); err != nil {
return fmt.Errorf("git add --all: %v", err)
- } else if err = git.CreateCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
+ }
+
+ err = git.CreateCommit(
+ localPath,
+ &git.Signature{
+ Name: doer.DisplayName(),
+ Email: doer.Email,
+ When: time.Now(),
+ },
+ opts.Message,
+ )
+ if err != nil {
return fmt.Errorf("commit changes on %q: %v", localPath, err)
}