Commit Graph

14 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
a514c7cf43
Check error when creating local storage directory
When we have an error creating the local storage directory, such as if
the permissions are wrong, we fail to produce a helpful error message,
since we fail to check the error we produce.

Let's take the error we get in such a case and pass it through to the
transfer queue, where we can handle it as any other error.  This means
that if only one directory has a problem, we can transfer the rest of
the objects and fail for only the one problematic object.
2020-02-10 16:07:59 +00:00
Marat Radchenko
482260c7e3 Fix error strings to follow Go guidelines
Error strings should not be capitalized (unless beginning with proper nouns or acronyms) or end with punctuation:
https://github.com/golang/go/wiki/CodeReviewComments#error-strings
2019-10-22 17:33:49 +03:00
brian m. carlson
1412d6e47a
Don't fail if we lack objects the server has
A Git LFS client may not have the entire history of the objects for the
repository. However, in some situations, we traverse the entire history
of a branch when pushing it, meaning that we need to process every
LFS object in the history of that branch. If the objects for the entire
history are not present, we currently fail to push.

Instead, let's mark objects we don't have on disk as missing and only
fail when we would need to upload those objects. We'll know the server
has the objects if the batch response provides no actions to take for
them when we request an upload. Pass the missing flag down through the
code, and always set it to false for non-uploads.

If for some reason we fail to properly flag a missing object, we will
still fail later on when we cannot open the file, just in a messier and
more poorly controlled way. The technique used here will attempt to
abort the batch as soon as we notice a problem, which means that in the
common case (less than 100 objects) we won't have transferred any
objects, so the user can notice the failure as soon as possible.

Update the tests to look for a string which will occur in the error
message, since we no longer produce the system error message for ENOENT.
2019-07-15 20:47:04 +00:00
brian m. carlson
cc815f59e6
Use proper repo permissions when creating directories
Honor the repository permssions set with the umask or
core.sharedRepository when creating directories by using tools.MkdirAll.
Pass an appropriate configuration or filesystem object through as needed
to ensure that we can query the proper permissions. Add a test that
these code paths work by cloning a new repository and then performing
some operations on it.

Note that in the test, we match patterns with either the setgid bit
clear or set, since it may be set or not depending on whether the system
has SysV or BSD group semantics.
2018-12-13 17:51:02 +00:00
Taylor Blau
5a3e5e9331
Merge pull request #3349 from steffengodskesen/tasklog-suppress-progress
tasklog: don't log progress status when stdout is not a tty
2018-11-14 14:36:15 -08:00
Steffen Godskesen
03aa2efced tasklog: don't log progress status when stdout is not a tty
But make it overridable by either
 - setting lfs.forceprogress 1
 - setting GIT_LFS_FORCE_PROGRESS=1
2018-11-14 14:35:29 -08:00
brian m. carlson
f8a659c855
t/git-lfs-test-server-api: fix reversed conditional
A refactor to this code, 3180a2d0 ("tq: use Rel() function to implement
multiActionSet", 2017-03-06), transformed various lookups such that when
a link, ok pair was returned, a check for ok became a check for link
being non-nil, and a check for !ok became a check for link being nil.
This is consistent with what the actual code does in this case: if
there's no link, a nil is returned for the link, and a nil error is
returned; otherwise, a valid link is returned, possibly with an error.

However, one of the places refactored was accidentally reversed, so we
complained that a link should not exist, and then reported that the
value received was in fact nil (which means that the link does not
exist—exactly what we were hoping for).  Reverse the sense of the check,
so that we're testing what we want and so that this test program passes
when run.
2018-11-13 19:44:41 +00:00
brian m. carlson
cac2782ac1
t/git-lfs-test-server-api: fix compilation issues
This program isn't built by default, so we didn't notice when refactors
caused it to no longer compile.  Update it so that it now compiles
correctly.
2018-11-13 19:44:40 +00:00
brian m. carlson
b0e5bac13f
Remove trailing whitespace
Trailing whitespace is generally considered harmful and untidy in both
code and text-based documentation.  Remove the instances of it in our
codebase.
2018-10-03 20:34:13 +00:00
Taylor Blau
c41afd5b29 t: import t/cmd/util in t/git-lfs-test-server-api/main.go 2018-07-13 13:05:19 -05:00
Taylor Blau
eb056fb74b t: move testutils.go to cmd sub-package 2018-07-13 12:54:18 -05:00
Taylor Blau
7b1420243e test: move to 'test' to 't'
By default, the prove(1) program looks for tests to run in the 't'
directory at the repository root, so let's put existing tests there in
order to remove a non-default argument from prove.
2018-07-09 16:07:32 -05:00