Commit Graph

19 Commits

Author SHA1 Message Date
brian m. carlson
087db1de70
Set package version to v3
Since we're about to do a v3.0.0 release, let's bump the version to v3.

Make this change automatically with the following command to avoid any
missed items:

  git grep -l github.com/git-lfs/git-lfs/v2 | \
  xargs sed -i -e 's!github.com/git-lfs/git-lfs/v2!github.com/git-lfs/git-lfs/v3!g'
2021-09-02 20:41:08 +00:00
Chris Darroch
dd8e306e31 all: update go.mod module path with explicit v2
When our go.mod file was introduced in commit
114e85c2002091eb415040923d872f8e4a4bc636 in PR #3208, the module
path chosen did not include a trailing /v2 component.  However,
the Go modules specification now advises that module paths must
have a "major version suffix" which matches the release version.

We therefore add a /v2 suffix to our module path and all its
instances in import paths.

See also https://golang.org/ref/mod#major-version-suffixes for
details regarding the Go module system's major version suffix rule.
2021-08-09 23:18:38 -07:00
brian m. carlson
29c9fdeffa
git: support SHA-256 in rev-list scanner
This code path has several 40-based constants.  Use the ObjectIDLengths
and ObjectIDRegex variables to parse these values in a way that works
for either SHA-1 or SHA-256.
2020-07-29 20:53:43 +00:00
brian m. carlson
9b745d99bb
git: add a function to check for a zero object ID
There are some places in our code that we need to check whether an
object ID is the all-zeros ID.  We've had several different pieces of
code to check this, but let's put a single function together to check
this regardless of the hash algorithm in use.

Remove all the other pieces of code which check for this, including a
couple which were not even used.
2020-07-29 20:53:43 +00:00
brian m. carlson
aab142ddb9
git: avoid "bad object" messages when force-pushing
If a user attempts to force-push over a ref and we don't currently have
the object that the reference currently points to, our pre-push hook
will fail with a message like the following:

  ref foo:: Error in git rev-list --stdin --objects --not --remotes=origin --: exit status 128 fatal: bad object 1aabb695d63c4d4afe731ab69573893390526896

This occurs because we pass the existing object name to git rev-list as
something to exclude.  Normally, this is a good idea, since it means we
can short-circuit the traversal since we already know what the other
side has.  However, in this case, it causes unwanted problems.

What we really want is for Git to just ignore an object if it's bad, and
fortunately the rev-list --ignore-missing object does exactly this, so
let's use it.  Note that we must pass it before the --stdin option since
otherwise it has no effect, so move the --stdin option to the end of the
command.
2020-04-23 15:13:31 +00:00
brian m. carlson
bbc3e24767
Optimize traversal of Git objects with URL remotes
We have an optimization that means we avoid traversing objects that
exist in the remote tracking branches of named remotes. We assume that
the server already has the LFS objects referred to by those Git objects.

However, this doesn't work for URL remotes, since there are no remote
tracking branches for them. Instead, let's make sure that we don't
traverse Git objects that are included in the old value of the ref,
which we know the server must have.

Note that this will not help the case where someone is pushing a new
branch to a URL remote; in that case, the old value is the all-zeros
value and we'll still have to traverse the entire history since we
haven't learned anything about what the server has.
2019-08-05 21:20:54 +00:00
Taylor Blau
73dcf26938 git: prefer sending revisions over STDIN than arguments 2017-11-17 09:41:19 -08:00
Lars Schneider
4a686891fa git: use wrapper functions to call Git with Git LFS disabled
The only side effect of this refactoring should be that the Git LFS
is disabled for the Git subprocess. No other functional changes are
intended.
2017-08-21 13:37:48 +02:00
Taylor Blau
182b411d6a git,lfs: make *git.RevListScanner take Include, Exclude []string 2017-06-08 11:22:30 -06:00
Taylor Blau
1927e28b35 git: teach opt.Reverse to *git.RevListScanner 2017-06-01 16:21:26 -06:00
Taylor Blau
23173cfd66 git: teach opt.WorkingDir to *git.RevListScanner 2017-06-01 16:21:21 -06:00
Taylor Blau
c5b7010e8a git/rev_list_scanner: teach CommitsOnly option 2017-05-25 09:44:56 -06:00
Taylor Blau
f4e7b3ba2d git/rev_list_scanner: extract RevListOrder.Flag() 2017-05-24 16:54:12 -06:00
Taylor Blau
a81a7ea27b git/rev_list_scanner: add --topo-order 2017-05-24 16:38:50 -06:00
Taylor Blau
2c94f86a60 git/rev_list_scanner: add --author-order 2017-05-24 16:38:38 -06:00
Taylor Blau
b1c5fe3547 git/rev_list_scanner: add --date-order 2017-05-24 16:38:08 -06:00
Taylor Blau
1411026b7b git/rev_list_scanner: allow specifying order to git-rev-list(1) 2017-05-24 16:37:30 -06:00
Taylor Blau
f7127717d6 git,lfs: inline RevListObject type into OID(), Name() 2017-05-24 13:52:01 -06:00
Taylor Blau
07ecd45397 git,lfs: extract git.RevListScanner 2017-05-24 12:54:32 -06:00