Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
rename
  • Loading branch information
6543 committed Jun 24, 2021
commit a2a118c7ca8f5e06441bcc7f92673fc879ca439c
4 changes: 2 additions & 2 deletions modules/git/batch_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func ReadBatchLine(rd *bufio.Reader) (sha []byte, typ string, size int64, err er
}
idx := strings.IndexByte(typ, ' ')
if idx < 0 {
log("missing space typ: %s", typ)
gogsLog("missing space typ: %s", typ)
err = ErrNotExist{ID: string(sha)}
return
}
Expand Down Expand Up @@ -230,7 +230,7 @@ func ParseTreeLine(rd *bufio.Reader, modeBuf, fnameBuf, shaBuf []byte) (mode, fn
}
idx := bytes.IndexByte(readBytes, ' ')
if idx < 0 {
log("missing space in readBytes ParseTreeLine: %s", readBytes)
gogsLog("missing space in readBytes ParseTreeLine: %s", readBytes)

err = &ErrNotExist{}
return
Expand Down
4 changes: 2 additions & 2 deletions modules/git/blob_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ func (b *Blob) Size() int64 {
defer cancel()
_, err := wr.Write([]byte(b.ID.String() + "\n"))
if err != nil {
log("error whilst reading size for %s in %s. Error: %v", b.ID.String(), b.repo.Path, err)
gogsLog("error whilst reading size for %s in %s. Error: %v", b.ID.String(), b.repo.Path, err)
return 0
}
_, _, b.size, err = ReadBatchLine(rd)
if err != nil {
log("error whilst reading size for %s in %s. Error: %v", b.ID.String(), b.repo.Path, err)
gogsLog("error whilst reading size for %s in %s. Error: %v", b.ID.String(), b.repo.Path, err)
return 0
}

Expand Down
6 changes: 3 additions & 3 deletions modules/git/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time.
}

if len(dir) == 0 {
log(c.String())
gogsLog(c.String())
} else {
log("%s: %v", dir, c)
gogsLog("%s: %v", dir, c)
}

ctx, cancel := context.WithTimeout(c.parentContext, timeout)
Expand Down Expand Up @@ -199,7 +199,7 @@ func (c *Command) RunInDirTimeoutEnv(env []string, timeout time.Duration, dir st
}

if stdout.Len() > 0 {
log("stdout:\n%s", stdout.Bytes()[:1024])
gogsLog("stdout:\n%s", stdout.Bytes()[:1024])
}
return stdout.Bytes(), nil
}
Expand Down
2 changes: 1 addition & 1 deletion modules/git/commit_info_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, commit *Commit, treePath
commitsInfo[i].SubModuleFile = subModuleFile
}
} else {
log("missing commit for %s", entry.Name())
gogsLog("missing commit for %s", entry.Name())
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/git/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func ParseDiffHunkString(diffhunk string) (leftLine, leftHunk, rightLine, righHu
righHunk, _ = strconv.Atoi(rightRange[1])
}
} else {
log("Parse line number failed: %v", diffhunk)
gogsLog("Parse line number failed: %v", diffhunk)
rightLine = leftLine
righHunk = leftHunk
}
Expand Down
2 changes: 1 addition & 1 deletion modules/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
goVersionLessThan115 = true
)

func log(format string, args ...interface{}) {
func gogsLog(format string, args ...interface{}) {
if !Debug {
return
}
Expand Down
4 changes: 2 additions & 2 deletions modules/git/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ const (

// SetUpdateHook writes given content to update hook of the repository.
func SetUpdateHook(repoPath, content string) (err error) {
log("Setting update hook: %s", repoPath)
gogsLog("Setting update hook: %s", repoPath)
hookPath := path.Join(repoPath, HookPathUpdate)
isExist, err := util.IsExist(hookPath)
if err != nil {
log("Unable to check if %s exists. Error: %v", hookPath, err)
gogsLog("Unable to check if %s exists. Error: %v", hookPath, err)
return err
}
if isExist {
Expand Down
2 changes: 1 addition & 1 deletion modules/git/last_commit_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ func (c *LastCommitCache) getCacheKey(repoPath, ref, entryPath string) string {

// Put put the last commit id with commit and entry path
func (c *LastCommitCache) Put(ref, entryPath, commitID string) error {
log("LastCommitCache save: [%s:%s:%s]", ref, entryPath, commitID)
gogsLog("LastCommitCache save: [%s:%s:%s]", ref, entryPath, commitID)
return c.cache.Put(c.getCacheKey(c.repoPath, ref, entryPath), commitID, c.ttl())
}
4 changes: 2 additions & 2 deletions modules/git/last_commit_cache_gogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func NewLastCommitCache(repoPath string, gitRepo *Repository, ttl func() int64,
func (c *LastCommitCache) Get(ref, entryPath string) (interface{}, error) {
v := c.cache.Get(c.getCacheKey(c.repoPath, ref, entryPath))
if vs, ok := v.(string); ok {
log("LastCommitCache hit level 1: [%s:%s:%s]", ref, entryPath, vs)
gogsLog("LastCommitCache hit level 1: [%s:%s:%s]", ref, entryPath, vs)
if commit, ok := c.commitCache[vs]; ok {
log("LastCommitCache hit level 2: [%s:%s:%s]", ref, entryPath, vs)
gogsLog("LastCommitCache hit level 2: [%s:%s:%s]", ref, entryPath, vs)
return commit, nil
}
id, err := c.repo.ConvertToSHA1(vs)
Expand Down
4 changes: 2 additions & 2 deletions modules/git/last_commit_cache_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func NewLastCommitCache(repoPath string, gitRepo *Repository, ttl func() int64,
func (c *LastCommitCache) Get(ref, entryPath string, wr WriteCloserError, rd *bufio.Reader) (interface{}, error) {
v := c.cache.Get(c.getCacheKey(c.repoPath, ref, entryPath))
if vs, ok := v.(string); ok {
log("LastCommitCache hit level 1: [%s:%s:%s]", ref, entryPath, vs)
gogsLog("LastCommitCache hit level 1: [%s:%s:%s]", ref, entryPath, vs)
if commit, ok := c.commitCache[vs]; ok {
log("LastCommitCache hit level 2: [%s:%s:%s]", ref, entryPath, vs)
gogsLog("LastCommitCache hit level 2: [%s:%s:%s]", ref, entryPath, vs)
return commit, nil
}
id, err := c.repo.ConvertToSHA1(vs)
Expand Down
2 changes: 1 addition & 1 deletion modules/git/parse_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ loop:
case "40000":
entry.entryMode = EntryModeTree
default:
log("Unknown mode: %v", string(mode))
gogsLog("Unknown mode: %v", string(mode))
return nil, fmt.Errorf("unknown mode: %v", string(mode))
}

Expand Down
4 changes: 2 additions & 2 deletions modules/git/repo_base_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func OpenRepository(repoPath string) (*Repository, error) {
// CatFileBatch obtains a CatFileBatch for this repository
func (repo *Repository) CatFileBatch() (WriteCloserError, *bufio.Reader, func()) {
if repo.batchCancel == nil || repo.batchReader.Buffered() > 0 {
log("Opening temporary cat file batch for: %s", repo.Path)
gogsLog("Opening temporary cat file batch for: %s", repo.Path)
return CatFileBatch(repo.Path)
}
return repo.batchWriter, repo.batchReader, func() {}
Expand All @@ -63,7 +63,7 @@ func (repo *Repository) CatFileBatch() (WriteCloserError, *bufio.Reader, func())
// CatFileBatchCheck obtains a CatFileBatchCheck for this repository
func (repo *Repository) CatFileBatchCheck() (WriteCloserError, *bufio.Reader, func()) {
if repo.checkCancel == nil || repo.checkReader.Buffered() > 0 {
log("Opening temporary cat file batch-check: %s", repo.Path)
gogsLog("Opening temporary cat file batch-check: %s", repo.Path)
return CatFileBatchCheck(repo.Path)
}
return repo.checkWriter, repo.checkReader, func() {}
Expand Down
4 changes: 2 additions & 2 deletions modules/git/repo_branch_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (repo *Repository) IsObjectExist(name string) bool {
defer cancel()
_, err := wr.Write([]byte(name + "\n"))
if err != nil {
log("Error writing to CatFileBatchCheck %v", err)
gogsLog("Error writing to CatFileBatchCheck %v", err)
return false
}
sha, _, _, err := ReadBatchLine(rd)
Expand All @@ -41,7 +41,7 @@ func (repo *Repository) IsReferenceExist(name string) bool {
defer cancel()
_, err := wr.Write([]byte(name + "\n"))
if err != nil {
log("Error writing to CatFileBatchCheck %v", err)
gogsLog("Error writing to CatFileBatchCheck %v", err)
return false
}
_, _, _, err = ReadBatchLine(rd)
Expand Down
2 changes: 1 addition & 1 deletion modules/git/repo_commit_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (repo *Repository) getCommitFromBatchReader(rd *bufio.Reader, id SHA1) (*Co

return commit, nil
default:
log("Unknown typ: %s", typ)
gogsLog("Unknown typ: %s", typ)
_, err = rd.Discard(int(size) + 1)
if err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions modules/git/repo_language_stats_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
}
shaBytes, typ, size, err := ReadBatchLine(batchReader)
if typ != "commit" {
log("Unable to get commit for: %s. Err: %v", commitID, err)
gogsLog("Unable to get commit for: %s. Err: %v", commitID, err)
return nil, ErrNotExist{commitID, ""}
}

sha, err := NewIDFromString(string(shaBytes))
if err != nil {
log("Unable to get commit for: %s. Err: %v", commitID, err)
gogsLog("Unable to get commit for: %s. Err: %v", commitID, err)
return nil, ErrNotExist{commitID, ""}
}

commit, err := CommitFromReader(repo, sha, io.LimitReader(batchReader, size))
if err != nil {
log("Unable to get commit for: %s. Err: %v", commitID, err)
gogsLog("Unable to get commit for: %s. Err: %v", commitID, err)
return nil, err
}
if _, err = batchReader.Discard(1); err != nil {
Expand Down Expand Up @@ -79,7 +79,7 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
}
_, _, size, err := ReadBatchLine(batchReader)
if err != nil {
log("Error reading blob: %s Err: %v", f.ID.String(), err)
gogsLog("Error reading blob: %s Err: %v", f.ID.String(), err)
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion modules/git/repo_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (repo *Repository) CreateAnnotatedTag(name, message, revision string) error
func (repo *Repository) getTag(tagID SHA1, name string) (*Tag, error) {
t, ok := repo.tagCache.Get(tagID.String())
if ok {
log("Hit cache: %s", tagID)
gogsLog("Hit cache: %s", tagID)
tagClone := *t.(*Tag)
tagClone.Name = name // This is necessary because lightweight tags may have same id
return &tagClone, nil
Expand Down