summaryrefslogtreecommitdiff
path: root/shell.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-05 20:04:38 -0500
committerJeff Carr <[email protected]>2025-10-05 20:04:38 -0500
commitd9ed0838c403e982f572d108542bcc16705049d9 (patch)
tree5d8229be3dbfcd068219417cf0039e7e37735eca /shell.go
parent7360716b35b452595e93c554d5f342b9f0338ea2 (diff)
logic for branch testing
Diffstat (limited to 'shell.go')
-rw-r--r--shell.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/shell.go b/shell.go
index 54b34c9..ace3482 100644
--- a/shell.go
+++ b/shell.go
@@ -170,7 +170,7 @@ func (repo *Repo) ConstructGitDiffLog(branch1, branch2 string) []string {
var cmd []string
cmd = append(cmd, "git")
cmd = append(cmd, "log")
- cmd = append(cmd, "--format=\"%H %ae %as %s\"")
+ cmd = append(cmd, "--format=\"%H%00%ae%00%as%00%s\"")
cmd = append(cmd, branch1)
cmd = append(cmd, "--not")
cmd = append(cmd, branch2)
@@ -188,6 +188,31 @@ func (repo *Repo) CountDiffObjects(branch1, branch2 string) (int, error) {
return len(r.Stdout), err
}
+// count all objects only in branch1
+func (repo *Repo) CountDiffObjectsNew(branch1, branch2 string) ([]string, error) {
+ cmd := repo.ConstructGitDiffLog(branch1, branch2)
+ r, err := repo.RunVerboseOnError(cmd)
+ if err != nil {
+ return nil, err
+ }
+ // log.Info("countDiffObjects()", cmd, len(r.Stdout), strings.Join(r.Stdout, " "))
+ return r.Stdout, err
+}
+
+func (repo *Repo) CountDiffObjectsVerbose(branch1, branch2 string) ([]string, error) {
+ cmd := repo.ConstructGitDiffLog(branch1, branch2)
+ r, err := repo.RunVerboseOnError(cmd)
+ if err != nil {
+ return nil, err
+ }
+ log.Info("Run:", cmd)
+ for _, line := range r.Stdout {
+ log.Info(line, branch1, branch2, repo.FullPath)
+ }
+ // log.Info("countDiffObjects()", cmd, len(r.Stdout), strings.Join(r.Stdout, " "))
+ return r.Stdout, err
+}
+
func (repo *Repo) RunPipe(cmd1 []string, cmd2 []string) cmd.Status {
var s cmd.Status
var arg0 string