mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Bump github.com/sahilm/fuzzy from 0.1.1 to 0.1.2 (#5606)
Bumps [github.com/sahilm/fuzzy](https://github.com/sahilm/fuzzy) from 0.1.1 to 0.1.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/sahilm/fuzzy/releases">github.com/sahilm/fuzzy's releases</a>.</em></p> <blockquote> <h2>v0.1.2</h2> <h2>What's Changed</h2> <ul> <li>Dust off the repo by <a href="https://github.com/sahilm"><code>@sahilm</code></a> in <a href="https://redirect.github.com/sahilm/fuzzy/pull/25">sahilm/fuzzy#25</a></li> <li>Ignore match strings past the first NUL rune by <a href="https://github.com/nfreya"><code>@nfreya</code></a> in <a href="https://redirect.github.com/sahilm/fuzzy/pull/24">sahilm/fuzzy#24</a></li> <li><code>FindFrom</code> respects original ordering by <a href="https://github.com/SayYoungMan"><code>@SayYoungMan</code></a> in <a href="https://redirect.github.com/sahilm/fuzzy/pull/28">sahilm/fuzzy#28</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/sahilm/fuzzy/compare/v0.1.1...v0.1.2">https://github.com/sahilm/fuzzy/compare/v0.1.1...v0.1.2</a></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="2cea772ce2"><code>2cea772</code></a> Upgrade golangci-lint to fix the build</li> <li><a href="76e61c374b"><code>76e61c3</code></a> <code>FindFrom</code> respects original ordering (<a href="https://redirect.github.com/sahilm/fuzzy/issues/28">#28</a>)</li> <li><a href="5ed613fa11"><code>5ed613f</code></a> Merge pull request <a href="https://redirect.github.com/sahilm/fuzzy/issues/24">#24</a> from nfreya/bugfix/panic-on-nuls-in-data</li> <li><a href="3e298b8b9b"><code>3e298b8</code></a> Merge branch 'master' into bugfix/panic-on-nuls-in-data</li> <li><a href="4546989695"><code>4546989</code></a> So long travis. Thank you.</li> <li><a href="f98d2a036a"><code>f98d2a0</code></a> switch to tools dujour; old ones deprecatd</li> <li><a href="45c5e49a0f"><code>45c5e49</code></a> Use go.mod now. Gopkg is deprecated.</li> <li><a href="12ea3fbc39"><code>12ea3fb</code></a> Add test for NULs in search data</li> <li><a href="7e3799a599"><code>7e3799a</code></a> Ignore match strings past the first NUL rune</li> <li>See full diff in <a href="https://github.com/sahilm/fuzzy/compare/v0.1.1...v0.1.2">compare view</a></li> </ul> </details> <br />
This commit is contained in:
commit
32f8a601e3
3
go.mod
3
go.mod
|
|
@ -26,7 +26,7 @@ require (
|
|||
github.com/mgutz/str v1.2.0
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
github.com/rivo/uniseg v0.4.7
|
||||
github.com/sahilm/fuzzy v0.1.1
|
||||
github.com/sahilm/fuzzy v0.1.2
|
||||
github.com/samber/lo v1.53.0
|
||||
github.com/sanity-io/litter v1.5.8
|
||||
github.com/sasha-s/go-deadlock v0.3.9
|
||||
|
|
@ -58,7 +58,6 @@ require (
|
|||
github.com/invopop/jsonschema v0.10.0 // indirect
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -107,8 +107,8 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
|
|||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA=
|
||||
github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
|
||||
github.com/sahilm/fuzzy v0.1.2 h1:kdSkz23lx1meNjEl+SLJULeSbjTI4Dn14K/YxdGrIww=
|
||||
github.com/sahilm/fuzzy v0.1.2/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8=
|
||||
github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM=
|
||||
github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
||||
github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg=
|
||||
|
|
|
|||
8
vendor/github.com/sahilm/fuzzy/.travis.yml
generated
vendored
8
vendor/github.com/sahilm/fuzzy/.travis.yml
generated
vendored
|
|
@ -1,8 +0,0 @@
|
|||
arch:
|
||||
- amd64
|
||||
- ppc64le
|
||||
language: go
|
||||
go:
|
||||
- 1.x
|
||||
script:
|
||||
- make
|
||||
20
vendor/github.com/sahilm/fuzzy/Gopkg.lock
generated
vendored
20
vendor/github.com/sahilm/fuzzy/Gopkg.lock
generated
vendored
|
|
@ -1,20 +0,0 @@
|
|||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:ee97ec8a00b2424570c1ce53d7b410e96fbd4c241b29df134276ff6aa3750335"
|
||||
name = "github.com/kylelemons/godebug"
|
||||
packages = [
|
||||
"diff",
|
||||
"pretty",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "d65d576e9348f5982d7f6d83682b694e731a45c6"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
input-imports = ["github.com/kylelemons/godebug/pretty"]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
4
vendor/github.com/sahilm/fuzzy/Gopkg.toml
generated
vendored
4
vendor/github.com/sahilm/fuzzy/Gopkg.toml
generated
vendored
|
|
@ -1,4 +0,0 @@
|
|||
# Test dependency
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/kylelemons/godebug"
|
||||
66
vendor/github.com/sahilm/fuzzy/Makefile
generated
vendored
66
vendor/github.com/sahilm/fuzzy/Makefile
generated
vendored
|
|
@ -1,14 +1,10 @@
|
|||
.PHONY: all
|
||||
all: setup lint test
|
||||
|
||||
PKGS := $(shell go list ./... | grep -v /vendor)
|
||||
.PHONY: test
|
||||
test: setup
|
||||
go test -bench ./...
|
||||
|
||||
.PHONY: cover
|
||||
cover: setup
|
||||
mkdir -p coverage
|
||||
gocov test ./... | gocov-html > coverage/coverage.html
|
||||
go test $(PKGS)
|
||||
|
||||
sources = $(shell find . -name '*.go' -not -path './vendor/*')
|
||||
.PHONY: goimports
|
||||
|
|
@ -17,41 +13,47 @@ goimports: setup
|
|||
|
||||
.PHONY: lint
|
||||
lint: setup
|
||||
gometalinter ./... --enable=goimports --disable=gocyclo --vendor -t
|
||||
$(BIN_DIR)/golangci-lint run
|
||||
|
||||
COVERAGE := $(CURDIR)/coverage
|
||||
COVER_PROFILE :=$(COVERAGE)/cover.out
|
||||
TMP_COVER_PROFILE :=$(COVERAGE)/cover.tmp
|
||||
.PHONY: cover
|
||||
cover: setup
|
||||
rm -rf $(COVERAGE)
|
||||
mkdir -p $(COVERAGE)
|
||||
echo "mode: set" > $(COVER_PROFILE)
|
||||
for pkg in $(PKGS); do \
|
||||
go test -v -coverprofile=$(TMP_COVER_PROFILE) $$pkg; \
|
||||
if [ -f $(TMP_COVER_PROFILE) ]; then \
|
||||
grep -v 'mode: set' $(TMP_COVER_PROFILE) >> $(COVER_PROFILE); \
|
||||
rm $(TMP_COVER_PROFILE); \
|
||||
fi; \
|
||||
done
|
||||
go tool cover -html=$(COVER_PROFILE) -o $(COVERAGE)/index.html
|
||||
|
||||
.PHONY: ci
|
||||
ci: setup lint test
|
||||
|
||||
.PHONY: install
|
||||
install: setup
|
||||
go install
|
||||
go install $(PKGS)
|
||||
|
||||
.PHONY: build
|
||||
build: setup
|
||||
go build $(PKGS)
|
||||
|
||||
GOPATH ?= $(HOME)/go
|
||||
BIN_DIR := $(GOPATH)/bin
|
||||
GOIMPORTS := $(BIN_DIR)/goimports
|
||||
GOMETALINTER := $(BIN_DIR)/gometalinter
|
||||
DEP := $(BIN_DIR)/dep
|
||||
GOCOV := $(BIN_DIR)/gocov
|
||||
GOCOV_HTML := $(BIN_DIR)/gocov-html
|
||||
GOLANG_CI_LINT := $(BIN_DIR)/golangci-lint
|
||||
|
||||
$(GOIMPORTS):
|
||||
go get -u golang.org/x/tools/cmd/goimports
|
||||
|
||||
$(GOMETALINTER):
|
||||
go get -u github.com/alecthomas/gometalinter
|
||||
gometalinter --install &> /dev/null
|
||||
$(GOLANG_CI_LINT):
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(BIN_DIR) v2.12.2
|
||||
|
||||
$(GOCOV):
|
||||
go get -u github.com/axw/gocov/gocov
|
||||
tools: $(GOIMPORTS) $(GOLANG_CI_LINT)
|
||||
|
||||
$(GOCOV_HTML):
|
||||
go get -u gopkg.in/matm/v1/gocov-html
|
||||
|
||||
$(DEP):
|
||||
go get -u github.com/golang/dep/cmd/dep
|
||||
|
||||
tools: $(GOIMPORTS) $(GOMETALINTER) $(GOCOV) $(GOCOV_HTML) $(DEP)
|
||||
|
||||
vendor: $(DEP)
|
||||
dep ensure
|
||||
|
||||
setup: tools vendor
|
||||
|
||||
updatedeps:
|
||||
dep ensure -update
|
||||
setup: tools
|
||||
|
|
|
|||
27
vendor/github.com/sahilm/fuzzy/fuzzy.go
generated
vendored
27
vendor/github.com/sahilm/fuzzy/fuzzy.go
generated
vendored
|
|
@ -7,6 +7,7 @@ package fuzzy
|
|||
|
||||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
|
@ -39,7 +40,7 @@ type Matches []Match
|
|||
|
||||
func (a Matches) Len() int { return len(a) }
|
||||
func (a Matches) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a Matches) Less(i, j int) bool { return a[i].Score >= a[j].Score }
|
||||
func (a Matches) Less(i, j int) bool { return a[i].Score > a[j].Score }
|
||||
|
||||
// Source represents an abstract source of a list of strings. Source must be iterable type such as a slice.
|
||||
// The source will be iterated over till Len() with String(i) being called for each element where i is the
|
||||
|
|
@ -114,7 +115,15 @@ func FindFromNoSort(pattern string, data Source) Matches {
|
|||
var matchedIndexes []int
|
||||
for i := 0; i < data.Len(); i++ {
|
||||
var match Match
|
||||
match.Str = data.String(i)
|
||||
matchStr := data.String(i)
|
||||
match.Str = matchStr
|
||||
// Limit matching to the first NUL rune, if any. We could maybe replace it
|
||||
// with whitespace, but this way doesn't allocate so much, and the presence
|
||||
// of NULs is most often an error by the library user.
|
||||
cleanMatchStr := matchStr
|
||||
if nullI := strings.IndexRune(matchStr, 0); nullI > -1 {
|
||||
cleanMatchStr = cleanMatchStr[:nullI]
|
||||
}
|
||||
match.Index = i
|
||||
if matchedIndexes != nil {
|
||||
match.MatchedIndexes = matchedIndexes
|
||||
|
|
@ -128,10 +137,10 @@ func FindFromNoSort(pattern string, data Source) Matches {
|
|||
currAdjacentMatchBonus := 0
|
||||
var last rune
|
||||
var lastIndex int
|
||||
nextc, nextSize := utf8.DecodeRuneInString(data.String(i))
|
||||
nextc, nextSize := utf8.DecodeRuneInString(cleanMatchStr)
|
||||
var candidate rune
|
||||
var candidateSize int
|
||||
for j := 0; j < len(data.String(i)); j += candidateSize {
|
||||
for j := 0; j < len(cleanMatchStr); j += candidateSize {
|
||||
candidate, candidateSize = nextc, nextSize
|
||||
if equalFold(candidate, runes[patternIndex]) {
|
||||
score = 0
|
||||
|
|
@ -161,11 +170,11 @@ func FindFromNoSort(pattern string, data Source) Matches {
|
|||
if patternIndex < len(runes)-1 {
|
||||
nextp = runes[patternIndex+1]
|
||||
}
|
||||
if j+candidateSize < len(data.String(i)) {
|
||||
if data.String(i)[j+candidateSize] < utf8.RuneSelf { // Fast path for ASCII
|
||||
nextc, nextSize = rune(data.String(i)[j+candidateSize]), 1
|
||||
if j+candidateSize < len(cleanMatchStr) {
|
||||
if cleanMatchStr[j+candidateSize] < utf8.RuneSelf { // Fast path for ASCII
|
||||
nextc, nextSize = rune(cleanMatchStr[j+candidateSize]), 1
|
||||
} else {
|
||||
nextc, nextSize = utf8.DecodeRuneInString(data.String(i)[j+candidateSize:])
|
||||
nextc, nextSize = utf8.DecodeRuneInString(cleanMatchStr[j+candidateSize:])
|
||||
}
|
||||
} else {
|
||||
nextc, nextSize = 0, 0
|
||||
|
|
@ -192,7 +201,7 @@ func FindFromNoSort(pattern string, data Source) Matches {
|
|||
last = candidate
|
||||
}
|
||||
// apply penalty for each unmatched character
|
||||
penalty := len(match.MatchedIndexes) - len(data.String(i))
|
||||
penalty := len(match.MatchedIndexes) - len(cleanMatchStr)
|
||||
match.Score += penalty
|
||||
if len(match.MatchedIndexes) == len(runes) {
|
||||
matches = append(matches, match)
|
||||
|
|
|
|||
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
|
|
@ -93,8 +93,6 @@ github.com/karimkhaleel/jsonschema
|
|||
github.com/kr/logfmt
|
||||
# github.com/kr/pretty v0.3.1
|
||||
## explicit; go 1.12
|
||||
# github.com/kylelemons/godebug v1.1.0
|
||||
## explicit; go 1.11
|
||||
# github.com/kyokomi/emoji/v2 v2.2.13
|
||||
## explicit; go 1.14
|
||||
github.com/kyokomi/emoji/v2
|
||||
|
|
@ -132,8 +130,8 @@ github.com/pmezard/go-difflib/difflib
|
|||
github.com/rivo/uniseg
|
||||
# github.com/rogpeppe/go-internal v1.14.1
|
||||
## explicit; go 1.23
|
||||
# github.com/sahilm/fuzzy v0.1.1
|
||||
## explicit
|
||||
# github.com/sahilm/fuzzy v0.1.2
|
||||
## explicit; go 1.24.5
|
||||
github.com/sahilm/fuzzy
|
||||
# github.com/samber/lo v1.53.0
|
||||
## explicit; go 1.18
|
||||
|
|
|
|||
Loading…
Reference in a new issue