go.*,vendor: bump gitobj to v2.1.0

Bump gitobj to v2.1.0 to fix merges of tree entries where an
existing tree entry has a different file permissions mode than
the tree entry being merged with it.  This should resolve the
problem with import migrations reported in issue #4796 where
existing .gitattributes files with the execute permission mode
set resulted in duplicate .gitattributes tree entries after
import, instead of a single merged entry.

After updating go.mod, the specific commands used for this update
were:
  go mod tidy && go mod vendor

h/t bk2204 for spotting the simplest fix for this
This commit is contained in:
Chris Darroch 2022-01-24 13:33:34 -08:00
parent a7d666a7ef
commit 133f29f763
4 changed files with 14 additions and 12 deletions

2
go.mod

@ -5,7 +5,7 @@ module github.com/git-lfs/git-lfs/v3
require (
github.com/avast/retry-go v2.4.2+incompatible
github.com/dpotapov/go-spnego v0.0.0-20210315154721-298b63a54430
github.com/git-lfs/gitobj/v2 v2.0.2
github.com/git-lfs/gitobj/v2 v2.1.0
github.com/git-lfs/go-netrc v0.0.0-20210914205454-f0c862dd687a
github.com/git-lfs/pktline v0.0.0-20210330133718-06e9096e2825
github.com/git-lfs/wildmatch/v2 v2.0.1

4
go.sum

@ -7,8 +7,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dpotapov/go-spnego v0.0.0-20210315154721-298b63a54430 h1:oempk9HjNt6rVKyKmpdnoN7XABQv3SXLWu3pxUI7Vlk=
github.com/dpotapov/go-spnego v0.0.0-20210315154721-298b63a54430/go.mod h1:AVSs/gZKt1bOd2AhkhbS7Qh56Hv7klde22yXVbwYJhc=
github.com/git-lfs/gitobj/v2 v2.0.2 h1:p8rWlhEyiSsC+4Qc+EdufySatf8sDtvJIrHAHgf7Ar8=
github.com/git-lfs/gitobj/v2 v2.0.2/go.mod h1:q6aqxl6Uu3gWsip5GEKpw+7459F97er8COmU45ncAxw=
github.com/git-lfs/gitobj/v2 v2.1.0 h1:5BUDAMga0Sv9msMXolrn6xplkiG5RaVEkOir2HSznog=
github.com/git-lfs/gitobj/v2 v2.1.0/go.mod h1:q6aqxl6Uu3gWsip5GEKpw+7459F97er8COmU45ncAxw=
github.com/git-lfs/go-netrc v0.0.0-20210914205454-f0c862dd687a h1:6pskVZacdMUL93pCpMAYnMDLjH1yDFhssPYGe32sjdk=
github.com/git-lfs/go-netrc v0.0.0-20210914205454-f0c862dd687a/go.mod h1:70O4NAtvWn1jW8V8V+OKrJJYcxDLTmIozfi2fmSz5SI=
github.com/git-lfs/pktline v0.0.0-20210330133718-06e9096e2825 h1:riQhgheTL7tMF4d5raz9t3+IzoR1i1wqxE1kZC6dY+U=

@ -115,22 +115,18 @@ func (t *Tree) Encode(to io.Writer) (n int, err error) {
func (t *Tree) Merge(others ...*TreeEntry) *Tree {
unseen := make(map[string]*TreeEntry)
// Build a cache of name+filemode to *TreeEntry.
// Build a cache of name to *TreeEntry.
for _, other := range others {
key := fmt.Sprintf("%s\x00%o", other.Name, other.Filemode)
unseen[key] = other
unseen[other.Name] = other
}
// Map the existing entries ("t.Entries") into a new set by either
// copying an existing entry, or replacing it with a new one.
entries := make([]*TreeEntry, 0, len(t.Entries))
for _, entry := range t.Entries {
key := fmt.Sprintf("%s\x00%o", entry.Name, entry.Filemode)
if other, ok := unseen[key]; ok {
if other, ok := unseen[entry.Name]; ok {
entries = append(entries, other)
delete(unseen, key)
delete(unseen, entry.Name)
} else {
oid := make([]byte, len(entry.Oid))
copy(oid, entry.Oid)
@ -234,6 +230,12 @@ func (e *TreeEntry) Type() ObjectType {
}
}
// IsLink returns true if the given TreeEntry is a blob which represents a
// symbolic link (i.e., with a filemode of 0120000.
func (e *TreeEntry) IsLink() bool {
return e.Filemode & sIFMT == sIFLNK
}
// SubtreeOrder is an implementation of sort.Interface that sorts a set of
// `*TreeEntry`'s according to "subtree" order. This ordering is required to
// write trees in a correct, readable format to the Git object database.

2
vendor/modules.txt vendored

@ -8,7 +8,7 @@ github.com/avast/retry-go
github.com/davecgh/go-spew/spew
# github.com/dpotapov/go-spnego v0.0.0-20210315154721-298b63a54430
github.com/dpotapov/go-spnego
# github.com/git-lfs/gitobj/v2 v2.0.2
# github.com/git-lfs/gitobj/v2 v2.1.0
github.com/git-lfs/gitobj/v2
github.com/git-lfs/gitobj/v2/errors
github.com/git-lfs/gitobj/v2/pack