commitHash returns the current commit hash of the repository. It returns an empty string (without error) when HEAD points to an unborn branch.
(ctx context.Context)
| 357 | // commitHash returns the current commit hash of the repository. |
| 358 | // It returns an empty string (without error) when HEAD points to an unborn branch. |
| 359 | func (r *gitRepo) commitHash(ctx context.Context) (string, error) { |
| 360 | hash, err := gitutil.Hash(ctx, r.repoDir, "HEAD") |
| 361 | if errors.Is(err, gitutil.ErrRefNotFound) { |
| 362 | return "", nil |
| 363 | } |
| 364 | return hash, err |
| 365 | } |
| 366 | |
| 367 | // commitTimestamp returns the timestamp of the latest commit on the current branch. |
| 368 | func (r *gitRepo) commitTimestamp(ctx context.Context) (time.Time, error) { |