@@ -63,7 +63,7 @@ var ctx = context.Background()
6363// getRef returns the commit branch reference object if it exists or creates it 
6464// from the base branch before returning it. 
6565func  getRef () (ref  * github.Reference , err  error ) {
66- 	if  ref , _ , err  =  client .Git .GetRef (ctx , * sourceOwner , * sourceRepo , "refs/heads/" + * commitBranch ); err  ==  nil  {
66+ 	if  ref , _ , err  =  client .Git .GetRef (ctx , * sourceOwner , * sourceRepo , branchRef ( * commitBranch ) ); err  ==  nil  {
6767		return  ref , nil 
6868	}
6969
@@ -78,14 +78,19 @@ func getRef() (ref *github.Reference, err error) {
7878	}
7979
8080	var  baseRef  * github.Reference 
81- 	if  baseRef , _ , err  =  client .Git .GetRef (ctx , * sourceOwner , * sourceRepo , "refs/heads/" + * baseBranch ); err  !=  nil  {
81+ 	if  baseRef , _ , err  =  client .Git .GetRef (ctx , * sourceOwner , * sourceRepo , branchRef ( * baseBranch ) ); err  !=  nil  {
8282		return  nil , err 
8383	}
84- 	newRef  :=  & github.Reference {Ref : github .Ptr ("refs/heads/"   +   * commitBranch ), Object : & github.GitObject {SHA : baseRef .Object .SHA }}
84+ 	newRef  :=  & github.Reference {Ref : github .Ptr (branchRef ( * commitBranch ) ), Object : & github.GitObject {SHA : baseRef .Object .SHA }}
8585	ref , _ , err  =  client .Git .CreateRef (ctx , * sourceOwner , * sourceRepo , newRef )
8686	return  ref , err 
8787}
8888
89+ // branchRef generates the fully qualified git reference for the given branch name. 
90+ func  branchRef (name  string ) string  {
91+ 	return  "refs/heads/"  +  name 
92+ }
93+ 
8994// getTree generates the tree to commit based on the given files and the commit 
9095// of the ref you got in getRef. 
9196func  getTree (ref  * github.Reference ) (tree  * github.Tree , err  error ) {
0 commit comments