| 282 | } |
| 283 | |
| 284 | func (c *Client) UncommittedChangeCount(ctx context.Context) (int, error) { |
| 285 | args := []string{"status", "--porcelain"} |
| 286 | cmd, err := c.Command(ctx, args...) |
| 287 | if err != nil { |
| 288 | return 0, err |
| 289 | } |
| 290 | out, err := cmd.Output() |
| 291 | if err != nil { |
| 292 | return 0, err |
| 293 | } |
| 294 | lines := strings.Split(string(out), "\n") |
| 295 | count := 0 |
| 296 | for _, l := range lines { |
| 297 | if l != "" { |
| 298 | count++ |
| 299 | } |
| 300 | } |
| 301 | return count, nil |
| 302 | } |
| 303 | |
| 304 | func (c *Client) Commits(ctx context.Context, baseRef, headRef string) ([]*Commit, error) { |
| 305 | // The formatting directive %x00 indicates that git should include the null byte as a separator. |