Skip to content

Commit

Permalink
Allow case-insensitive state revert HEAD.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Dec 15, 2023
1 parent cc9fcfb commit 6199541
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/runners/revert/revert.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package revert

import (
"strings"

"github.com/ActiveState/cli/internal/analytics"
"github.com/ActiveState/cli/internal/errs"
"github.com/ActiveState/cli/internal/locale"
Expand Down Expand Up @@ -63,14 +65,14 @@ func (r *Revert) Run(params *Params) (rerr error) {
}

commitID := params.CommitID
if !strfmt.IsUUID(commitID) && commitID != headCommitID {
if !strfmt.IsUUID(commitID) && !strings.EqualFold(commitID, headCommitID) {
return locale.NewInputError("err_invalid_commit_id", "Invalid commit ID")
}
latestCommit, err := commitmediator.Get(r.project)
if err != nil {
return errs.Wrap(err, "Unable to get local commit")
}
if commitID == headCommitID {
if strings.EqualFold(commitID, headCommitID) {
commitID = latestCommit.String()
}

Expand Down

0 comments on commit 6199541

Please sign in to comment.