Skip to content

Commit d4ed610

Browse files
committed
Fix bug
1 parent 50b018e commit d4ed610

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

services/repository/branch.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,16 @@ func GetBranchDivergingInfo(ctx reqctx.RequestContext, baseRepo *repo_model.Repo
716716
return info, nil
717717
}
718718

719+
// we need fetch the necessary commits from the head repo first if it's not the same repository
720+
if baseRepo.ID != headRepo.ID {
721+
if _, _, err := git.NewCommand("fetch", "--no-tags").
722+
AddDynamicArguments(headRepo.RepoPath()).
723+
AddDynamicArguments(headGitBranch.CommitID).
724+
RunStdString(ctx, &git.RunOpts{Dir: baseRepo.RepoPath()}); err != nil {
725+
return nil, err
726+
}
727+
}
728+
719729
// if the fork repo has new commits, this call will fail because they are not in the base repo
720730
// exit status 128 - fatal: Invalid symmetric difference expression aaaaaaaaaaaa...bbbbbbbbbbbb
721731
// so at the moment, we first check the update time, then check whether the fork branch has base's head

0 commit comments

Comments
 (0)