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