mirror of https://github.com/harness/drone.git
fix: [CODE-3315]: Rename parameter max to maxCount (#3529)
* Rename parameter max to maxCounttry-new-ui
parent
79ce90c7d8
commit
ec12dda66b
|
@ -590,13 +590,13 @@ func (g *Git) GetCommits(
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCommitDivergences returns the count of the diverging commits for all branch pairs.
|
// GetCommitDivergences returns the count of the diverging commits for all branch pairs.
|
||||||
// IMPORTANT: If a max is provided it limits the overal count of diverging commits
|
// IMPORTANT: If a maxCount is provided it limits the overal count of diverging commits
|
||||||
// (max 10 could lead to (0, 10) while it's actually (2, 12)).
|
// (maxCount 10 could lead to (0, 10) while it's actually (2, 12)).
|
||||||
func (g *Git) GetCommitDivergences(
|
func (g *Git) GetCommitDivergences(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
repoPath string,
|
repoPath string,
|
||||||
requests []CommitDivergenceRequest,
|
requests []CommitDivergenceRequest,
|
||||||
max int32,
|
maxCount int32,
|
||||||
) ([]CommitDivergence, error) {
|
) ([]CommitDivergence, error) {
|
||||||
if repoPath == "" {
|
if repoPath == "" {
|
||||||
return nil, ErrRepositoryPathEmpty
|
return nil, ErrRepositoryPathEmpty
|
||||||
|
@ -604,7 +604,7 @@ func (g *Git) GetCommitDivergences(
|
||||||
var err error
|
var err error
|
||||||
res := make([]CommitDivergence, len(requests))
|
res := make([]CommitDivergence, len(requests))
|
||||||
for i, req := range requests {
|
for i, req := range requests {
|
||||||
res[i], err = g.getCommitDivergence(ctx, repoPath, req, max)
|
res[i], err = g.getCommitDivergence(ctx, repoPath, req, maxCount)
|
||||||
if errors.IsNotFound(err) {
|
if errors.IsNotFound(err) {
|
||||||
res[i] = CommitDivergence{Ahead: -1, Behind: -1}
|
res[i] = CommitDivergence{Ahead: -1, Behind: -1}
|
||||||
continue
|
continue
|
||||||
|
@ -618,21 +618,21 @@ func (g *Git) GetCommitDivergences(
|
||||||
}
|
}
|
||||||
|
|
||||||
// getCommitDivergence returns the count of diverging commits for a pair of branches.
|
// getCommitDivergence returns the count of diverging commits for a pair of branches.
|
||||||
// IMPORTANT: If a max is provided it limits the overall count of diverging commits
|
// IMPORTANT: If a maxCount is provided it limits the overall count of diverging commits
|
||||||
// (max 10 could lead to (0, 10) while it's actually (2, 12)).
|
// (maxCount 10 could lead to (0, 10) while it's actually (2, 12)).
|
||||||
func (g *Git) getCommitDivergence(
|
func (g *Git) getCommitDivergence(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
repoPath string,
|
repoPath string,
|
||||||
req CommitDivergenceRequest,
|
req CommitDivergenceRequest,
|
||||||
max int32,
|
maxCount int32,
|
||||||
) (CommitDivergence, error) {
|
) (CommitDivergence, error) {
|
||||||
cmd := command.New("rev-list",
|
cmd := command.New("rev-list",
|
||||||
command.WithFlag("--count"),
|
command.WithFlag("--count"),
|
||||||
command.WithFlag("--left-right"),
|
command.WithFlag("--left-right"),
|
||||||
)
|
)
|
||||||
// limit count if requested.
|
// limit count if requested.
|
||||||
if max > 0 {
|
if maxCount > 0 {
|
||||||
cmd.Add(command.WithFlag("--max-count", strconv.Itoa(int(max))))
|
cmd.Add(command.WithFlag("--max-count", strconv.Itoa(int(maxCount))))
|
||||||
}
|
}
|
||||||
// add query to get commits without shared base commits
|
// add query to get commits without shared base commits
|
||||||
cmd.Add(command.WithArg(req.From + "..." + req.To))
|
cmd.Add(command.WithArg(req.From + "..." + req.To))
|
||||||
|
|
Loading…
Reference in New Issue