Commit Graph

5 Commits

Author SHA1 Message Date
brian m. carlson
7cc4bce5e4
Bump wildmatch to v2.0.1
Now that we have a fully Git-compatible wildmatch, let's use it in Git
LFS.  Vendor the module appropriately.
2021-08-26 15:48:54 +00:00
brian m. carlson
da4fdef00b
Support SHA-256 repositories
Git will start to support SHA-256 as a hash for repositories in the near
future.  Let's update gitobj to version 2 to support SHA-256
repositories properly.  We initialize the repository based on the
extensions.objectFormat value, if one is provided, since this is the
configuration key that represents the hash algorithm.

Vendor the proper dependencies in place.
2020-07-29 20:53:44 +00:00
Lars Lehtonen
55a12834c7
git/gitattr: fix dropped test errors 2019-11-06 13:07:05 -08:00
Taylor Blau
ff62456c55 git/gitattr/tree_test.go: ensure that children are given appropriately
The TestNewDiscovers*ChildrenTrees tests ensure that child trees are
discovered and applied to given paths correctly.

To make sure that we aren't applying patterns from the wrong place,
let's ensure that the top-level Lines is empty, implying that any
applied attributes come from a child.

This is a safe thing to do, since Lines and Children are both part of
the public scope of a *gitattr.Tree instance, and therefore should be in
a correct state and use-able by any caller who wishes to do so.
2018-07-09 12:04:06 -05:00
Taylor Blau
58ae7f7f8e git/gitattr: introduce package 'gitattr'
This commit introduces package github.com/git-lfs/git-lfs/git/gitattr,
which manifests a tree-like representation of a repository's
.gitattribute file(s).

It introduces the following top-level and member functions:

  - func ParseLines(r io.Reader) ([]*Line, error)

  Parses the lines of a .gitattributes-like io.Reader into a set of
  wildmatch to attribute-set pairings, or an error if one was
  encountered.

  - func New(db *gitobj.ObjectDatabase, t *gitobj.Tree) (*Tree, error)

  Visits all trees reachable from "t" in a depth-first search to
  reconstruct a tree-representation of all .gitattributes file(s) in the
  repository.

  - func (t *Tree) Applied(to string) []*Attr

  Finds all attributes in-order that are applied to "to" relative to the
  receiving *Tree's location in the repository's tree structure.

This will become useful in subsequent commits when this is used to scan
a repository's .gitattributes files before rewriting the blobs in that
repository during the forthcoming 'git lfs migrate import --fixup' mode.
2018-07-06 14:42:48 -05:00