@@ -43,7 +43,6 @@ func getPullWorkingLockKey(prID int64) string {
4343type  NewPullRequestOptions  struct  {
4444	Repo             * repo_model.Repository 
4545	Issue            * issues_model.Issue 
46- 	HeadCommitID     string 
4746	LabelIDs         []int64 
4847	AttachmentUUIDs  []string 
4948	PullRequest      * issues_model.PullRequest 
@@ -54,7 +53,7 @@ type NewPullRequestOptions struct {
5453
5554// NewPullRequest creates new pull request with labels for repository. 
5655func  NewPullRequest (ctx  context.Context , opts  * NewPullRequestOptions ) error  {
57- 	if  opts .PullRequest .Flow  ==  issues_model .PullRequestFlowAGit  &&  opts .HeadCommitID  ==  ""  {
56+ 	if  opts .PullRequest .Flow  ==  issues_model .PullRequestFlowAGit  &&  opts .PullRequest . HeadCommitID  ==  ""  {
5857		return  errors .New ("head commit ID cannot be empty for agit flow" )
5958	}
6059
@@ -131,7 +130,7 @@ func NewPullRequest(ctx context.Context, opts *NewPullRequestOptions) error {
131130
132131		// update head commit id into git repository 
133132		if  pr .Flow  ==  issues_model .PullRequestFlowAGit  {
134- 			err  =  UpdatePullRequestAgitFlowHead (ctx , pr , opts .HeadCommitID )
133+ 			err  =  UpdatePullRequestAgitFlowHead (ctx , pr , pr .HeadCommitID )
135134		} else  {
136135			err  =  UpdatePullRequestGithubFlowHead (ctx , pr )
137136		}
@@ -771,12 +770,12 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
771770	if  pr .Flow  ==  issues_model .PullRequestFlowGithub  {
772771		headCommit , err  =  gitRepo .GetBranchCommit (pr .HeadBranch )
773772	} else  {
774- 		headCommitID ,  err1   : =gitRepo .GetRefCommitID (pr .GetGitHeadRefName ())
775- 		if  err1  !=  nil  {
776- 			log .Error ("Unable to get head commit: %s Error: %v" , pr .GetGitHeadRefName (), err1 )
773+ 		pr . HeadCommitID ,  err   =  gitRepo .GetRefCommitID (pr .GetGitHeadRefName ())
774+ 		if  err  !=  nil  {
775+ 			log .Error ("Unable to get head commit: %s Error: %v" , pr .GetGitHeadRefName (), err )
777776			return  "" 
778777		}
779- 		headCommit , err  =  gitRepo .GetCommit (headCommitID )
778+ 		headCommit , err  =  gitRepo .GetCommit (pr . HeadCommitID )
780779	}
781780	if  err  !=  nil  {
782781		log .Error ("Unable to get head commit: %s Error: %v" , pr .HeadBranch , err )
@@ -998,11 +997,11 @@ func IsHeadEqualWithBranch(ctx context.Context, pr *issues_model.PullRequest, br
998997			return  false , err 
999998		}
1000999	} else  {
1001- 		headCommitID , err  : =baseGitRepo .GetRefCommitID (pr .GetGitHeadRefName ())
1000+ 		pr . HeadCommitID , err  =  baseGitRepo .GetRefCommitID (pr .GetGitHeadRefName ())
10021001		if  err  !=  nil  {
10031002			return  false , err 
10041003		}
1005- 		if  headCommit , err  =  baseGitRepo .GetCommit (headCommitID ); err  !=  nil  {
1004+ 		if  headCommit , err  =  baseGitRepo .GetCommit (pr . HeadCommitID ); err  !=  nil  {
10061005			return  false , err 
10071006		}
10081007	}
0 commit comments