Skip to content

Commit

Permalink
bubble up more detailed git errors (#427)
Browse files Browse the repository at this point in the history
* bubble up more detailed git errors

* pr feedback
  • Loading branch information
Florian Hines authored Oct 11, 2024
1 parent 571bf73 commit f2a6981
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cli/cmd/release_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ func (r *runners) gitSHABranch() (sha string, branch string, dirty bool, err err
rev := "HEAD"
repository, err := git.PlainOpenWithOptions(path, &git.PlainOpenOptions{DetectDotGit: true})
if err != nil {
return "", "", false, errors.Wrapf(err, "open %q", path)
return "", "", false, fmt.Errorf("git open '%q' failed: %w", path, err)
}
h, err := repository.ResolveRevision(plumbing.Revision(rev))
if err != nil {
return "", "", false, errors.Wrapf(err, "resolve revision")
return "", "", false, fmt.Errorf("git resolve revision '%q' failed: %w", rev, err)
}
head, err := repository.Head()
if err != nil {
return "", "", false, errors.Wrapf(err, "resolve HEAD")
return "", "", false, fmt.Errorf("git resolve HEAD failed: %w", err)
}

worktree, err := repository.Worktree()
if err != nil {
return "", "", false, errors.Wrap(err, "get git worktree")
return "", "", false, fmt.Errorf("git get worktree failed: %w", err)
}
status, err := worktree.Status()
if err != nil {
return "", "", false, errors.Wrap(err, "get git status")
return "", "", false, fmt.Errorf("git get status failed: %w", err)
}

branchName := head.Name().Short()
Expand Down

0 comments on commit f2a6981

Please sign in to comment.