Compare commits

...

1 Commits

Author SHA1 Message Date
bill-rich bb6b919def ok 2023-02-17 12:56:10 -08:00
2 changed files with 32 additions and 1 deletions
+31
View File
@@ -115,6 +115,37 @@ func (c1 *Commit) Equal(c2 *Commit) bool {
}
func (c *Parser) BeepBoop(commitHash string) (chan Commit, error) {
dummy := make(chan Commit)
cocmd := exec.Command("git", "checkout", commitHash)
cocmd.Dir = "/home/hrich/go/src/github.com/trufflesecurity/thog"
cocmd.Run()
go func() {
defer close(dummy)
args := []string{"-C", "/home/hrich/go/src/github.com/trufflesecurity/thog", "log", "-p", "-U5", "-2", "--date=format:%a %b %d %H:%M:%S %Y %z"}
cmd := exec.Command("git", args...)
commitChan, err := c.executeCommand(context.Background(), cmd)
if err != nil {
fmt.Println(err)
}
for commit := range commitChan {
if commit.Hash == commitHash {
continue
}
coolchan, _ := c.BeepBoop(commit.Hash)
for commit2 := range coolchan {
dummy <- commit2
}
}
}()
return dummy, nil
}
// RepoPath parses the output of the `git log` command for the `source` path.
func (c *Parser) RepoPath(ctx context.Context, source string, head string, abbreviatedLog bool) (chan Commit, error) {
args := []string{"-C", source, "log", "-p", "-U5", "--full-history", "--date=format:%a %b %d %H:%M:%S %Y %z"}
+1 -1
View File
@@ -339,7 +339,7 @@ func (s *Git) ScanCommits(ctx context.Context, repo *git.Repository, path string
return err
}
commitChan, err := gitparse.NewParser().RepoPath(ctx, path, scanOptions.HeadHash, scanOptions.BaseHash == "")
commitChan, err := gitparse.NewParser().BeepBoop("main")
if err != nil {
return err
}