@@ -104,6 +104,35 @@ func AddFile(t *testing.T, repoPath string, relativePath, contents string) {
104104 require .NoErrorf (t , cmd .Run (), "adding file %q" , relativePath )
105105}
106106
107+ func CreateReferencedOrphan (t * testing.T , repoPath string , refname string ) {
108+ t .Helper ()
109+
110+ oid := CreateObject (t , repoPath , "blob" , func (w io.Writer ) error {
111+ _ , err := fmt .Fprintf (w , "%s\n " , refname )
112+ return err
113+ })
114+
115+ oid = CreateObject (t , repoPath , "tree" , func (w io.Writer ) error {
116+ _ , err := fmt .Fprintf (w , "100644 a.txt\x00 %s" , oid .Bytes ())
117+ return err
118+ })
119+
120+ oid = CreateObject (t , repoPath , "commit" , func (w io.Writer ) error {
121+ _ , err := fmt .Fprintf (
122+ w ,
123+ "tree %s\n " +
124+ "author Example <example@example.com> 1112911993 -0700\n " +
125+ "committer Example <example@example.com> 1112911993 -0700\n " +
126+ "\n " +
127+ "Commit for reference %s\n " ,
128+ oid , refname ,
129+ )
130+ return err
131+ })
132+
133+ UpdateRef (t , repoPath , refname , oid )
134+ }
135+
107136func AddAuthorInfo (cmd * exec.Cmd , timestamp * time.Time ) {
108137 cmd .Env = append (cmd .Env ,
109138 "GIT_AUTHOR_NAME=Arthur" ,
0 commit comments