| 338 | } |
| 339 | |
| 340 | func (c *Client) UncommittedChangeCount(ctx context.Context) (int, error) { |
| 341 | args := []string{"status", "--porcelain"} |
| 342 | cmd, err := c.Command(ctx, args...) |
| 343 | if err != nil { |
| 344 | return 0, err |
| 345 | } |
| 346 | out, err := cmd.Output() |
| 347 | if err != nil { |
| 348 | return 0, err |
| 349 | } |
| 350 | lines := strings.Split(string(out), "\n") |
| 351 | count := 0 |
| 352 | for _, l := range lines { |
| 353 | if l != "" { |
| 354 | count++ |
| 355 | } |
| 356 | } |
| 357 | return count, nil |
| 358 | } |
| 359 | |
| 360 | func (c *Client) Commits(ctx context.Context, baseRef, headRef string) ([]*Commit, error) { |
| 361 | // The formatting directive %x00 indicates that git should include the null byte as a separator. |