Skip to content

Commit ace647d

Browse files
committed
Revert change of ConcatenateError
1 parent ce0ec3b commit ace647d

16 files changed

+27
-39
lines changed

modules/git/batch_reader.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"strings"
1414

1515
"code.gitea.io/gitea/modules/log"
16-
"code.gitea.io/gitea/modules/util"
1716

1817
"github.com/djherbis/buffer"
1918
"github.com/djherbis/nio/v3"
@@ -36,7 +35,7 @@ func ensureValidGitRepository(ctx context.Context, repoPath string) error {
3635
Stderr: &stderr,
3736
})
3837
if err != nil {
39-
return util.ConcatenateError(err, (&stderr).String())
38+
return ConcatenateError(err, (&stderr).String())
4039
}
4140
return nil
4241
}
@@ -72,8 +71,8 @@ func catFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError,
7271
UseContextTimeout: true,
7372
})
7473
if err != nil {
75-
_ = batchStdoutWriter.CloseWithError(util.ConcatenateError(err, (&stderr).String()))
76-
_ = batchStdinReader.CloseWithError(util.ConcatenateError(err, (&stderr).String()))
74+
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
75+
_ = batchStdinReader.CloseWithError(ConcatenateError(err, (&stderr).String()))
7776
} else {
7877
_ = batchStdoutWriter.Close()
7978
_ = batchStdinReader.Close()
@@ -120,8 +119,8 @@ func catFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufi
120119
UseContextTimeout: true,
121120
})
122121
if err != nil {
123-
_ = batchStdoutWriter.CloseWithError(util.ConcatenateError(err, (&stderr).String()))
124-
_ = batchStdinReader.CloseWithError(util.ConcatenateError(err, (&stderr).String()))
122+
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
123+
_ = batchStdinReader.CloseWithError(ConcatenateError(err, (&stderr).String()))
125124
} else {
126125
_ = batchStdoutWriter.Close()
127126
_ = batchStdinReader.Close()

modules/git/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ type runStdError struct {
380380
func (r *runStdError) Error() string {
381381
// the stderr must be in the returned error text, some code only checks `strings.Contains(err.Error(), "git error")`
382382
if r.errMsg == "" {
383-
r.errMsg = util.ConcatenateError(r.err, r.stderr).Error()
383+
r.errMsg = ConcatenateError(r.err, r.stderr).Error()
384384
}
385385
return r.errMsg
386386
}

modules/git/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ func GetCommitFileStatus(ctx context.Context, repoPath, commitID string) (*Commi
448448
})
449449
w.Close() // Close writer to exit parsing goroutine
450450
if err != nil {
451-
return nil, util.ConcatenateError(err, stderr.String())
451+
return nil, ConcatenateError(err, stderr.String())
452452
}
453453

454454
<-done

modules/git/log_name_status.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"strings"
1515

1616
"code.gitea.io/gitea/modules/container"
17-
"code.gitea.io/gitea/modules/util"
1817

1918
"github.com/djherbis/buffer"
2019
"github.com/djherbis/nio/v3"
@@ -71,7 +70,7 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p
7170
Stderr: &stderr,
7271
})
7372
if err != nil {
74-
_ = stdoutWriter.CloseWithError(util.ConcatenateError(err, (&stderr).String()))
73+
_ = stdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
7574
return
7675
}
7776

modules/git/pipeline/lfs_nogogit.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"sync"
1515

1616
"code.gitea.io/gitea/modules/git"
17-
"code.gitea.io/gitea/modules/util"
1817
)
1918

2019
// FindLFSFile finds commits that contain a provided pointer file hash
@@ -39,7 +38,7 @@ func FindLFSFile(repo *git.Repository, objectID git.ObjectID) ([]*LFSResult, err
3938
Stderr: &stderr,
4039
})
4140
if err != nil {
42-
_ = revListWriter.CloseWithError(util.ConcatenateError(err, (&stderr).String()))
41+
_ = revListWriter.CloseWithError(git.ConcatenateError(err, (&stderr).String()))
4342
} else {
4443
_ = revListWriter.Close()
4544
}

modules/git/repo.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"time"
1919

2020
"code.gitea.io/gitea/modules/proxy"
21-
"code.gitea.io/gitea/modules/util"
2221
)
2322

2423
// GPGSettings represents the default GPG settings for this repository
@@ -177,7 +176,7 @@ func CloneWithArgs(ctx context.Context, args TrustedCmdArgs, from, to string, op
177176
Stdout: io.Discard,
178177
Stderr: stderr,
179178
}); err != nil {
180-
return util.ConcatenateError(err, stderr.String())
179+
return ConcatenateError(err, stderr.String())
181180
}
182181
return nil
183182
}

modules/git/repo_archive.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import (
1010
"io"
1111
"path/filepath"
1212
"strings"
13-
14-
"code.gitea.io/gitea/modules/util"
1513
)
1614

1715
// ArchiveType archive types
@@ -69,7 +67,7 @@ func (repo *Repository) CreateArchive(ctx context.Context, format ArchiveType, t
6967
Stderr: &stderr,
7068
})
7169
if err != nil {
72-
return util.ConcatenateError(err, stderr.String())
70+
return ConcatenateError(err, stderr.String())
7371
}
7472
return nil
7573
}

modules/git/repo_branch_nogogit.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"strings"
1515

1616
"code.gitea.io/gitea/modules/log"
17-
"code.gitea.io/gitea/modules/util"
1817
)
1918

2019
// IsObjectExist returns true if the given object exists in the repository.
@@ -120,7 +119,7 @@ func WalkShowRef(ctx context.Context, repoPath string, extraArgs TrustedCmdArgs,
120119
_ = stdoutWriter.Close()
121120
return
122121
}
123-
_ = stdoutWriter.CloseWithError(util.ConcatenateError(err, stderrBuilder.String()))
122+
_ = stdoutWriter.CloseWithError(ConcatenateError(err, stderrBuilder.String()))
124123
} else {
125124
_ = stdoutWriter.Close()
126125
}

modules/git/repo_commit.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"code.gitea.io/gitea/modules/cache"
1515
"code.gitea.io/gitea/modules/setting"
16-
"code.gitea.io/gitea/modules/util"
1716
)
1817

1918
// GetBranchCommitID returns last commit ID string of given branch.
@@ -240,7 +239,7 @@ func (repo *Repository) CommitsByFileAndRange(opts CommitsByFileAndRangeOptions)
240239
Stderr: &stderr,
241240
})
242241
if err != nil {
243-
_ = stdoutWriter.CloseWithError(util.ConcatenateError(err, (&stderr).String()))
242+
_ = stdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
244243
} else {
245244
_ = stdoutWriter.Close()
246245
}

modules/git/repo_ref_nogogit.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"bufio"
1010
"io"
1111
"strings"
12-
13-
"code.gitea.io/gitea/modules/util"
1412
)
1513

1614
// GetRefsFiltered returns all references of the repository that matches patterm exactly or starting with.
@@ -29,7 +27,7 @@ func (repo *Repository) GetRefsFiltered(pattern string) ([]*Reference, error) {
2927
Stderr: stderrBuilder,
3028
})
3129
if err != nil {
32-
_ = stdoutWriter.CloseWithError(util.ConcatenateError(err, stderrBuilder.String()))
30+
_ = stdoutWriter.CloseWithError(ConcatenateError(err, stderrBuilder.String()))
3331
} else {
3432
_ = stdoutWriter.Close()
3533
}

0 commit comments

Comments
 (0)