mirror of
https://github.com/Pull-Pal/pull-pal.git
synced 2024-09-18 18:06:10 -04:00
cbec4c1be9
focus on fully automated as basic/default functionality. remove unnecessary commands except for local git debug. remove unnecessary interfaces and code. remove local git functionality from github client. probably some other stuff too
48 lines
995 B
Go
48 lines
995 B
Go
package pullpal
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/mobyvb/pull-pal/llm"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func (p *PullPal) DebugGit() error {
|
|
p.log.Info("Starting Pull Pal git debug")
|
|
|
|
// create commit with file changes
|
|
err := p.localGitClient.StartCommit()
|
|
//err = p.ghClient.StartCommit()
|
|
if err != nil {
|
|
p.log.Error("error starting commit", zap.Error(err))
|
|
return err
|
|
}
|
|
newBranchName := fmt.Sprintf("debug-branch")
|
|
|
|
for _, f := range []string{"a", "b"} {
|
|
err = p.localGitClient.ReplaceOrAddLocalFile(llm.File{
|
|
Path: f,
|
|
Contents: "hello",
|
|
})
|
|
if err != nil {
|
|
p.log.Error("error replacing or adding file", zap.Error(err))
|
|
return err
|
|
}
|
|
}
|
|
|
|
commitMessage := "debug commit message"
|
|
err = p.localGitClient.FinishCommit(commitMessage)
|
|
if err != nil {
|
|
p.log.Error("error finishing commit", zap.Error(err))
|
|
return err
|
|
}
|
|
|
|
err = p.localGitClient.PushBranch(newBranchName)
|
|
if err != nil {
|
|
p.log.Error("error pushing branch", zap.Error(err))
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|