Skip to content

Commit 2f74aec

Browse files
committed
remove unused functions
1 parent 21cc4aa commit 2f74aec

File tree

2 files changed

+0
-48
lines changed

2 files changed

+0
-48
lines changed

modules/git/commit_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package git
55

66
import (
7-
"os"
87
"path/filepath"
98
"strings"
109
"testing"
@@ -339,18 +338,3 @@ func TestGetCommitFileStatusMerges(t *testing.T) {
339338
assert.Equal(t, expected.Removed, commitFileStatus.Removed)
340339
assert.Equal(t, expected.Modified, commitFileStatus.Modified)
341340
}
342-
343-
func Test_GetCommitBranchStart(t *testing.T) {
344-
bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
345-
repo, err := OpenRepository(t.Context(), bareRepo1Path)
346-
assert.NoError(t, err)
347-
defer repo.Close()
348-
commit, err := repo.GetBranchCommit("branch1")
349-
assert.NoError(t, err)
350-
assert.Equal(t, "2839944139e0de9737a044f78b0e4b40d989a9e3", commit.ID.String())
351-
352-
startCommitID, err := repo.GetCommitBranchStart(os.Environ(), "branch1", commit.ID.String())
353-
assert.NoError(t, err)
354-
assert.NotEmpty(t, startCommitID)
355-
assert.Equal(t, "95bb4d39648ee7e325106df01a621c530863a653", startCommitID)
356-
}

modules/git/repo_commit.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -534,35 +534,3 @@ func (repo *Repository) AddLastCommitCache(cacheKey, fullName, sha string) error
534534
}
535535
return nil
536536
}
537-
538-
// GetCommitBranchStart returns the commit where the branch diverged
539-
func (repo *Repository) GetCommitBranchStart(env []string, branch, endCommitID string) (string, error) {
540-
cmd := gitcmd.NewCommand("log", prettyLogFormat)
541-
cmd.AddDynamicArguments(endCommitID)
542-
543-
stdout, _, runErr := cmd.RunStdBytes(repo.Ctx, &gitcmd.RunOpts{
544-
Dir: repo.Path,
545-
Env: env,
546-
})
547-
if runErr != nil {
548-
return "", runErr
549-
}
550-
551-
parts := bytes.SplitSeq(bytes.TrimSpace(stdout), []byte{'\n'})
552-
553-
// check the commits one by one until we find a commit contained by another branch
554-
// and we think this commit is the divergence point
555-
for commitID := range parts {
556-
branches, err := repo.getBranches(env, string(commitID), 2)
557-
if err != nil {
558-
return "", err
559-
}
560-
for _, b := range branches {
561-
if b != branch {
562-
return string(commitID), nil
563-
}
564-
}
565-
}
566-
567-
return "", nil
568-
}

0 commit comments

Comments
 (0)