mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2026-03-21 13:55:30 +00:00
29 lines
461 B
Go
29 lines
461 B
Go
package git
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type Commit struct {
|
|
Repo *Repo
|
|
Path string
|
|
URL string
|
|
Branch string
|
|
Hash string
|
|
Email string
|
|
Name string
|
|
Date time.Time
|
|
}
|
|
|
|
func (g *Commit) ValidateCommit() error {
|
|
if g.Hash == "" || g.Date.IsZero() {
|
|
return InvalidStateError
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (g Commit) String() string {
|
|
return fmt.Sprintf("Path: %s\nURL: %s\nBranch: %s\nHash: %s\nDate: %s", g.Path, g.URL, g.Branch, g.Hash, g.Date)
|
|
}
|