Skip to content

Commit dc34734

Browse files
committed
make vendor
1 parent e718b77 commit dc34734

File tree

15 files changed

+645
-33
lines changed

15 files changed

+645
-33
lines changed

modules/git/commit_info.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,13 @@ func (state *getCommitsInfoState) getTargetedEntryPath() string {
7272
}
7373

7474
// repeatedly perform targeted searches for unpopulated entries
75-
func targetedSearch(state *getCommitsInfoState, done chan error, cache LastCommitCache) {
75+
func targetedSearch(state *getCommitsInfoState, done chan error) {
7676
for {
7777
entryPath := state.getTargetedEntryPath()
7878
if len(entryPath) == 0 {
7979
done <- nil
8080
return
8181
}
82-
if cache != nil {
83-
commit, err := cache.Get(state.headCommit.repo.Path, state.headCommit.ID.String(), entryPath)
84-
if err == nil && commit != nil {
85-
state.update(entryPath, commit)
86-
continue
87-
}
88-
}
8982
command := NewCommand("rev-list", "-1", state.headCommit.ID.String(), "--", entryPath)
9083
output, err := command.RunInDir(state.headCommit.repo.Path)
9184
if err != nil {
@@ -103,9 +96,6 @@ func targetedSearch(state *getCommitsInfoState, done chan error, cache LastCommi
10396
return
10497
}
10598
state.update(entryPath, commit)
106-
if cache != nil {
107-
cache.Put(state.headCommit.repo.Path, state.headCommit.ID.String(), entryPath, commit)
108-
}
10999
}
110100
}
111101

@@ -128,9 +118,9 @@ func initGetCommitInfoState(entries Entries, headCommit *Commit, treePath string
128118
}
129119

130120
// GetCommitsInfo gets information of all commits that are corresponding to these entries
131-
func (tes Entries) GetCommitsInfo(commit *Commit, treePath string, cache LastCommitCache) ([][]interface{}, error) {
121+
func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interface{}, error) {
132122
state := initGetCommitInfoState(tes, commit, treePath)
133-
if err := getCommitsInfo(state, cache); err != nil {
123+
if err := getCommitsInfo(state); err != nil {
134124
return nil, err
135125
}
136126
if len(state.commits) < len(state.entryPaths) {
@@ -198,7 +188,7 @@ func (state *getCommitsInfoState) update(entryPath string, commit *Commit) bool
198188

199189
const getCommitsInfoPretty = "--pretty=format:%H %ct %s"
200190

201-
func getCommitsInfo(state *getCommitsInfoState, cache LastCommitCache) error {
191+
func getCommitsInfo(state *getCommitsInfoState) error {
202192
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
203193
defer cancel()
204194

@@ -225,7 +215,7 @@ func getCommitsInfo(state *getCommitsInfoState, cache LastCommitCache) error {
225215
numThreads := runtime.NumCPU()
226216
done := make(chan error, numThreads)
227217
for i := 0; i < numThreads; i++ {
228-
go targetedSearch(state, done, cache)
218+
go targetedSearch(state, done)
229219
}
230220

231221
scanner := bufio.NewScanner(readCloser)

modules/git/repo_commit.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@ func (repo *Repository) GetBranchCommitID(name string) (string, error) {
3232

3333
// GetTagCommitID returns last commit ID string of given tag.
3434
func (repo *Repository) GetTagCommitID(name string) (string, error) {
35-
stdout, err := NewCommand("rev-list", "-n", "1", name).RunInDir(repo.Path)
36-
if err != nil {
37-
if strings.Contains(err.Error(), "unknown revision or path") {
38-
return "", ErrNotExist{name, ""}
39-
}
40-
return "", err
41-
}
42-
return strings.TrimSpace(stdout), nil
35+
return repo.GetRefCommitID(TagPrefix + name)
4336
}
4437

4538
// parseCommitData parses commit information from the (uncompressed) raw
@@ -101,11 +94,7 @@ l:
10194
sig, err := newGPGSignatureFromCommitline(data, (nextline+1)+sigindex, true)
10295
if err == nil && sig != nil {
10396
// remove signature from commit message
104-
if sigindex == 0 {
105-
cm = ""
106-
} else {
107-
cm = cm[:sigindex-1]
108-
}
97+
cm = cm[:sigindex-1]
10998
commit.Signature = sig
11099
}
111100
}
@@ -157,14 +146,13 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
157146
func (repo *Repository) GetCommit(commitID string) (*Commit, error) {
158147
if len(commitID) != 40 {
159148
var err error
160-
actualCommitID, err := NewCommand("rev-parse", commitID).RunInDir(repo.Path)
149+
commitID, err = NewCommand("rev-parse", commitID).RunInDir(repo.Path)
161150
if err != nil {
162151
if strings.Contains(err.Error(), "unknown revision or path") {
163152
return nil, ErrNotExist{commitID, ""}
164153
}
165154
return nil, err
166155
}
167-
commitID = actualCommitID
168156
}
169157
id, err := NewIDFromString(commitID)
170158
if err != nil {

modules/git/repo_tag.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ func (repo *Repository) getTag(id SHA1) (*Tag, error) {
7676

7777
// GetTag returns a Git tag by given name.
7878
func (repo *Repository) GetTag(name string) (*Tag, error) {
79-
idStr, err := repo.GetTagCommitID(name)
79+
stdout, err := NewCommand("show-ref", "--tags", name).RunInDir(repo.Path)
8080
if err != nil {
8181
return nil, err
8282
}
8383

84-
id, err := NewIDFromString(idStr)
84+
id, err := NewIDFromString(strings.Split(stdout, " ")[0])
8585
if err != nil {
8686
return nil, err
8787
}

vendor/code.gitea.io/git/.drone.yml

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/code.gitea.io/git/.editorconfig

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/code.gitea.io/git/.gitignore

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/code.gitea.io/git/.lgtm

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/code.gitea.io/git/CONTRIBUTING.md

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/code.gitea.io/git/DCO

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)