diff options
Diffstat (limited to 'stat.makeRemote.go')
| -rw-r--r-- | stat.makeRemote.go | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/stat.makeRemote.go b/stat.makeRemote.go index a5d746a..0dbd7a3 100644 --- a/stat.makeRemote.go +++ b/stat.makeRemote.go @@ -5,9 +5,11 @@ import ( "path/filepath" "strings" + "go.wit.com/lib/cobol" "go.wit.com/lib/config" "go.wit.com/lib/env" "go.wit.com/log" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) // loads what is on disk already. that is all @@ -52,9 +54,9 @@ func (r *Repo) MakeRemote(remoteName string) (*Stats, error) { var counter int for _, line := range cmdout.Stdout { line = strings.TrimSpace(line) - parts := strings.Fields(line) - if len(parts) != 2 { - log.Printf("Repo: %s\n", r.FullPath) + parts := strings.Split(line, standardSeperator) + if len(parts) != 5 { + log.Printf("Repo: %s len(%d)\n", r.FullPath, len(parts)) log.Printf("CMD: %v\n", cmd) log.Printf("LINE:%s\n", line) return stats, errors.New(line) @@ -65,6 +67,17 @@ func (r *Repo) MakeRemote(remoteName string) (*Stats, error) { counter += 1 newstat := new(Stat) newstat.Hash = parts[0] + newstat.TreeHash = parts[1] + t, err := cobol.GetTime(parts[2]) + _ = err + if t != nil { + newstat.AuthorTime = timestamppb.New(*t) + } + t, err = cobol.GetTime(parts[3]) + if t != nil { + newstat.CommitTime = timestamppb.New(*t) + } + newstat.SanitizedSubject = parts[4] stats.Append(newstat) } if counter > 0 { |
