Skip to content

Commit

Permalink
git: ActionRefRanges - allow '^' negation prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Oct 13, 2024
1 parent 593ec72 commit ac1a70d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/actions/tools/git/ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ func ActionRefs(refOption RefOption) carapace.Action {
// v.0.0.3^2~03...v0.0.4~03 (last commit msg)
func ActionRefRanges(opts RefOption) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if strings.HasPrefix(c.Value, "^") { // negate
c.Value = c.Value[1:]
return ActionRefs(opts).Invoke(c).ToA().NoSpace().Prefix("^")
}

delimiter := ".."
if strings.Contains(c.Value, "...") && strings.Count(c.Value, "..") == 1 {
delimiter = "..."
Expand Down

0 comments on commit ac1a70d

Please sign in to comment.