summaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/batch_reader.go10
-rw-r--r--modules/git/blob_nogogit.go2
-rw-r--r--modules/git/commit.go2
-rw-r--r--modules/git/commit_info_nogogit.go2
-rw-r--r--modules/git/diff.go2
-rw-r--r--modules/git/pipeline/lfs_nogogit.go2
-rw-r--r--modules/git/repo_attribute.go2
-rw-r--r--modules/git/repo_base_nogogit.go2
-rw-r--r--modules/git/repo_branch_nogogit.go2
-rw-r--r--modules/git/repo_compare.go6
-rw-r--r--modules/git/repo_compare_test.go4
-rw-r--r--modules/git/repo_index.go2
-rw-r--r--modules/git/repo_tag_nogogit.go2
-rw-r--r--modules/git/sha1_nogogit.go2
-rw-r--r--modules/git/signature_nogogit.go2
-rw-r--r--modules/git/utils.go2
16 files changed, 23 insertions, 23 deletions
diff --git a/modules/git/batch_reader.go b/modules/git/batch_reader.go
index 902fa89718..feb0dd31be 100644
--- a/modules/git/batch_reader.go
+++ b/modules/git/batch_reader.go
@@ -176,12 +176,12 @@ func ReadBatchLine(rd *bufio.Reader) (sha []byte, typ string, size int64, err er
typ = typ[:idx]
size, err = strconv.ParseInt(sizeStr, 10, 64)
- return
+ return sha, typ, size, err
}
// ReadTagObjectID reads a tag object ID hash from a cat-file --batch stream, throwing away the rest of the stream.
func ReadTagObjectID(rd *bufio.Reader, size int64) (string, error) {
- id := ""
+ var id string
var n int64
headerLoop:
for {
@@ -216,7 +216,7 @@ headerLoop:
// ReadTreeID reads a tree ID from a cat-file --batch stream, throwing away the rest of the stream.
func ReadTreeID(rd *bufio.Reader, size int64) (string, error) {
- id := ""
+ var id string
var n int64
headerLoop:
for {
@@ -328,7 +328,7 @@ func ParseTreeLine(rd *bufio.Reader, modeBuf, fnameBuf, shaBuf []byte) (mode, fn
// Deal with the 20-byte SHA
idx = 0
for idx < 20 {
- read := 0
+ var read int
read, err = rd.Read(shaBuf[idx:20])
n += read
if err != nil {
@@ -337,7 +337,7 @@ func ParseTreeLine(rd *bufio.Reader, modeBuf, fnameBuf, shaBuf []byte) (mode, fn
idx += read
}
sha = shaBuf
- return
+ return mode, fname, sha, n, err
}
var callerPrefix string
diff --git a/modules/git/blob_nogogit.go b/modules/git/blob_nogogit.go
index 211c188559..89bb98162f 100644
--- a/modules/git/blob_nogogit.go
+++ b/modules/git/blob_nogogit.go
@@ -99,7 +99,7 @@ func (b *blobReader) Read(p []byte) (n int, err error) {
}
n, err = b.rd.Read(p)
b.n -= int64(n)
- return
+ return n, err
}
// Close implements io.Closer
diff --git a/modules/git/commit.go b/modules/git/commit.go
index 82b5e0b25d..82712dd1ef 100644
--- a/modules/git/commit.go
+++ b/modules/git/commit.go
@@ -418,7 +418,7 @@ func (c *Commit) LoadBranchName() (err error) {
}
c.Branch, err = c.GetBranchName()
- return
+ return err
}
// GetTagName gets the current tag name for given commit
diff --git a/modules/git/commit_info_nogogit.go b/modules/git/commit_info_nogogit.go
index f430c672f8..ceab11adbb 100644
--- a/modules/git/commit_info_nogogit.go
+++ b/modules/git/commit_info_nogogit.go
@@ -157,7 +157,7 @@ func GetLastCommitForPaths(ctx context.Context, cache *LastCommitCache, commit *
if typ != "commit" {
return nil, fmt.Errorf("unexpected type: %s for commit id: %s", typ, commitID)
}
- c, err = CommitFromReader(commit.repo, MustIDFromString(string(commitID)), io.LimitReader(batchReader, int64(size)))
+ c, err = CommitFromReader(commit.repo, MustIDFromString(commitID), io.LimitReader(batchReader, size))
if err != nil {
return nil, err
}
diff --git a/modules/git/diff.go b/modules/git/diff.go
index c9d68bb130..f75ebd4fd2 100644
--- a/modules/git/diff.go
+++ b/modules/git/diff.go
@@ -115,7 +115,7 @@ func ParseDiffHunkString(diffhunk string) (leftLine, leftHunk, rightLine, righHu
rightLine = leftLine
righHunk = leftHunk
}
- return
+ return leftLine, leftHunk, rightLine, righHunk
}
// Example: @@ -1,8 +1,9 @@ => [..., 1, 8, 1, 9]
diff --git a/modules/git/pipeline/lfs_nogogit.go b/modules/git/pipeline/lfs_nogogit.go
index a2b5dd0c96..061da8ca50 100644
--- a/modules/git/pipeline/lfs_nogogit.go
+++ b/modules/git/pipeline/lfs_nogogit.go
@@ -116,7 +116,7 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
continue
case "commit":
// Read in the commit to get its tree and in case this is one of the last used commits
- curCommit, err = git.CommitFromReader(repo, git.MustIDFromString(string(commitID)), io.LimitReader(batchReader, int64(size)))
+ curCommit, err = git.CommitFromReader(repo, git.MustIDFromString(string(commitID)), io.LimitReader(batchReader, size))
if err != nil {
return nil, err
}
diff --git a/modules/git/repo_attribute.go b/modules/git/repo_attribute.go
index 596a91e803..1305e6f224 100644
--- a/modules/git/repo_attribute.go
+++ b/modules/git/repo_attribute.go
@@ -334,7 +334,7 @@ func (wr *lineSeparatedAttributeWriter) Write(p []byte) (n int, err error) {
wr.tmp = []byte(remaining[3:])
break
}
- return l, fmt.Errorf("unexpected tail %s", string(remaining))
+ return l, fmt.Errorf("unexpected tail %s", remaining)
}
_, _ = sb.WriteRune(rn)
remaining = tail
diff --git a/modules/git/repo_base_nogogit.go b/modules/git/repo_base_nogogit.go
index df24d952a8..63c278c261 100644
--- a/modules/git/repo_base_nogogit.go
+++ b/modules/git/repo_base_nogogit.go
@@ -101,5 +101,5 @@ func (repo *Repository) Close() (err error) {
repo.checkReader = nil
repo.checkWriter = nil
}
- return
+ return err
}
diff --git a/modules/git/repo_branch_nogogit.go b/modules/git/repo_branch_nogogit.go
index bc58991085..2983a35ca5 100644
--- a/modules/git/repo_branch_nogogit.go
+++ b/modules/git/repo_branch_nogogit.go
@@ -95,7 +95,7 @@ func callShowRef(ctx context.Context, repoPath, prefix, arg string, skip, limit
return nil
})
- return
+ return branchNames, countAll, err
}
func walkShowRef(ctx context.Context, repoPath, arg string, skip, limit int, walkfn func(sha1, refname string) error) (countAll int, err error) {
diff --git a/modules/git/repo_compare.go b/modules/git/repo_compare.go
index 3c7af73000..577c9f475e 100644
--- a/modules/git/repo_compare.go
+++ b/modules/git/repo_compare.go
@@ -132,7 +132,7 @@ type lineCountWriter struct {
func (l *lineCountWriter) Write(p []byte) (n int, err error) {
n = len(p)
l.numLines += bytes.Count(p, []byte{'\000'})
- return
+ return n, err
}
// GetDiffNumChangedFiles counts the number of changed files
@@ -177,7 +177,7 @@ func (repo *Repository) GetDiffShortStat(base, head string) (numFiles, totalAddi
if err != nil && strings.Contains(err.Error(), "no merge base") {
return GetDiffShortStat(repo.Ctx, repo.Path, base, head)
}
- return
+ return numFiles, totalAdditions, totalDeletions, err
}
// GetDiffShortStat counts number of changed files, number of additions and deletions
@@ -231,7 +231,7 @@ func parseDiffStat(stdout string) (numFiles, totalAdditions, totalDeletions int,
return 0, 0, 0, fmt.Errorf("unable to parse shortstat: %s. Error parsing NumDeletions %v", stdout, err)
}
}
- return
+ return numFiles, totalAdditions, totalDeletions, err
}
// GetDiffOrPatch generates either diff or formatted patch data between given revisions
diff --git a/modules/git/repo_compare_test.go b/modules/git/repo_compare_test.go
index e163a3090b..245920c2bd 100644
--- a/modules/git/repo_compare_test.go
+++ b/modules/git/repo_compare_test.go
@@ -117,8 +117,8 @@ func TestReadWritePullHead(t *testing.T) {
return
}
- assert.Len(t, string(headContents), 40)
- assert.True(t, string(headContents) == newCommit)
+ assert.Len(t, headContents, 40)
+ assert.True(t, headContents == newCommit)
// Remove file after the test
err = repo.RemoveReference(PullPrefix + "1/head")
diff --git a/modules/git/repo_index.go b/modules/git/repo_index.go
index ae68dcaa87..50d82c77d7 100644
--- a/modules/git/repo_index.go
+++ b/modules/git/repo_index.go
@@ -64,7 +64,7 @@ func (repo *Repository) ReadTreeToTemporaryIndex(treeish string) (filename, tmpD
defer cancel()
return "", "", func() {}, err
}
- return
+ return filename, tmpDir, cancel, err
}
// EmptyIndex empties the index
diff --git a/modules/git/repo_tag_nogogit.go b/modules/git/repo_tag_nogogit.go
index 8d44db0a2e..9a574666f8 100644
--- a/modules/git/repo_tag_nogogit.go
+++ b/modules/git/repo_tag_nogogit.go
@@ -27,7 +27,7 @@ func (repo *Repository) IsTagExist(name string) bool {
// returning at most limit tags, or all if limit is 0.
func (repo *Repository) GetTags(skip, limit int) (tags []string, err error) {
tags, _, err = callShowRef(repo.Ctx, repo.Path, TagPrefix, "--tags", skip, limit)
- return
+ return tags, err
}
// GetTagType gets the type of the tag, either commit (simple) or tag (annotated)
diff --git a/modules/git/sha1_nogogit.go b/modules/git/sha1_nogogit.go
index 1835c68f5a..a2620cba69 100644
--- a/modules/git/sha1_nogogit.go
+++ b/modules/git/sha1_nogogit.go
@@ -58,5 +58,5 @@ func NewHasher(t ObjectType, size int64) Hasher {
// Sum generates a SHA1 for the provided hash
func (h Hasher) Sum() (sha1 SHA1) {
copy(sha1[:], h.Hash.Sum(nil))
- return
+ return sha1
}
diff --git a/modules/git/signature_nogogit.go b/modules/git/signature_nogogit.go
index 81da739a5b..2fc8dde04d 100644
--- a/modules/git/signature_nogogit.go
+++ b/modules/git/signature_nogogit.go
@@ -91,5 +91,5 @@ func newSignatureFromCommitline(line []byte) (sig *Signature, err error) {
return
}
}
- return
+ return sig, err
}
diff --git a/modules/git/utils.go b/modules/git/utils.go
index 53c124ac8a..d6bf9f4413 100644
--- a/modules/git/utils.go
+++ b/modules/git/utils.go
@@ -163,7 +163,7 @@ func (l *LimitedReaderCloser) Read(p []byte) (n int, err error) {
}
n, err = l.R.Read(p)
l.N -= int64(n)
- return
+ return n, err
}
// Close implements io.Closer