Skip to content

Commit 709ea40

Browse files
committed
add comment
1 parent 5e0b719 commit 709ea40

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/git/repo_commit.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ func (repo *Repository) AddLastCommitCache(cacheKey, fullName, sha string) error
519519
return nil
520520
}
521521

522+
// GetCommitBranchStart returns the commit where the branch diverged
522523
func (repo *Repository) GetCommitBranchStart(env []string, branch, endCommitID string) (string, error) {
523524
cmd := NewCommand(repo.Ctx, "log", prettyLogFormat)
524525
cmd.AddDynamicArguments(endCommitID)
@@ -533,6 +534,8 @@ func (repo *Repository) GetCommitBranchStart(env []string, branch, endCommitID s
533534

534535
parts := bytes.Split(bytes.TrimSpace(stdout), []byte{'\n'})
535536

537+
// check the commits one by one until we find a commit contained by another branch
538+
// and we think this commit is the divergence point
536539
for _, commitID := range parts {
537540
branches, err := repo.getBranches(env, string(commitID), 2)
538541
if err != nil {

0 commit comments

Comments
 (0)