Commit Graph

489 Commits

Author SHA1 Message Date
risk danger olson
a227c22aeb Merge pull request #619 from ttaylorr/promote-hooks
lfs: promote Hooks and Attributes to types
2015-09-02 14:45:35 -06:00
risk danger olson
3226d2a652 Merge pull request #624 from github/prefer-batch-api
batch API changes for v0.6.0
2015-09-02 10:53:52 -06:00
Steve Streeting
972efa6303 Go 1.5 fix: Use sync channel, not just queue.Wait() to ensure xfers done
Go 1.5 is genuinely parallel and we cannot guarantee that the transfer
channel from TransferQueue is fully read from before q.Wait() returns;
they can be parallel. Instead use our own sync channel on the closing
of the transfer channel.
2015-09-02 16:49:42 +01:00
Taylor Blau
3b9b0f2b7f lfs/setup, commands: revert Setup/Teardown to Install/Uninstall 2015-09-01 18:20:02 -04:00
Taylor Blau
c7cb8e0303 lfs: promote Hooks and Filters to types
This commit introduces two new types into the API: Hook, and Filter.

Both `Hook` and `Filter` are abstractions built on Git hooks and filters
respectively. Each type knows how to install and uninstall itself. These
processes are utilized by the setup method in the `lfs` package, and the
appropriate calls have been updated in the init and uninit commands.

These abstractions were introduced to make adding/removing required filters and
hooks easier for future projects, including the migration away from the smudge
filter.

Eventually it seems appropriate to move both new types into the `git` package,
as opposed to the `lfs` package. At the time of writing this commit, there is
some coupling against state defined in the `lfs` package (i.e., whether or not
we're currently in a git repo, the local working directory, etc). At somepoint
it would be nice to remove that coupling and move these new types into the
`git` package.
2015-09-01 18:19:34 -04:00
risk danger olson
5930c7ff66 show the endpoint auth type in 'git lfs env' 2015-09-01 15:47:47 -06:00
rubyist
ca2a93a1b9 Merge branch 'master' into errors 2015-09-01 10:48:22 -04:00
Steve Streeting
7519896f98 Change default fetch recent to include remote refs from current remote
Previously only local branches were included by default. However this
way is more useful in practice; otherwise when you needed to checkout
or pull new commits from the remote you were forced to fetch on demand;
fetch --recent wouldn't pick them up without including the remote
branches. While you *can* create / update local branches without
checking out manually (e.g. git reset to manually fast-forward) to make
fetch --recent then pickup the changes from local branches, it's
too cumbersome. Including remote refs by default makes more sense for
most people, respecting the idea that you do this as an optimistic fetch
to save time at checkout/pull. However, limit the operation to the
current remote only (which makes sense anyway).
2015-09-01 12:37:24 +01:00
rubyist
c57a8992e2 Error context can hold any kind of data, simplify the cleanPointerError 2015-08-28 12:08:57 -04:00
rubyist
80beead369 Bring DownloadDeclinedError into errors system.
I'm not really happy with the way we use errors to control this flow.
I'd like to see it refactored to not rely on a specific error to control
this. The download bool is there, we should rely on that.
2015-08-27 11:42:23 -04:00
rubyist
dbeb15ecfa Prevent error data loss, give not a pointer error a default message 2015-08-27 11:31:44 -04:00
rubyist
e434980035 Merge branch 'master' into errors 2015-08-27 11:20:04 -04:00
Steve Streeting
58decd038f Tweak fetch recent output a little 2015-08-27 15:31:36 +01:00
Steve Streeting
1cacc9532f Fix failure to push non-current branch #606
Use of CurrentRef as 'left' doesn't work when pushing any other branch.
Instead use specified ref vs remote state.
2015-08-26 17:47:11 +01:00
Steve Streeting
41cdd013c2 Add oids to push --dry-run output otherwise can't see modifications 2015-08-26 17:47:11 +01:00
Steve Streeting
2fa370e0c9 Slightly more tracing in fetch 2015-08-26 16:22:53 +01:00
Steve Streeting
b7323b3521 Alter call to ScanRefs in fetch to use --no-walk (snapshot only)
Previously if there were modified files at any point in ref's history,
they would all be fetched at the ref instead of just a snapshot of the
current state.
2015-08-26 16:13:50 +01:00
Steve Streeting
aeca33c3ee Merge branch 'push-other-branch' into fetch-recent 2015-08-26 14:39:59 +01:00
Steve Streeting
c65ed368cc Fix failure to push non-current branch #606
Use of CurrentRef as 'left' doesn't work when pushing any other branch.
Instead use specified ref vs remote state.
2015-08-26 11:29:57 +01:00
Steve Streeting
31d887db05 Add oids to push --dry-run output otherwise can't see modifications 2015-08-26 11:26:50 +01:00
rubyist
1f1821c08b replace NotAPointerError 2015-08-22 19:21:13 -04:00
rubyist
187c6cb6e1 wErr -> err 2015-08-21 14:31:06 -04:00
rubyist
cd754db91a First pass at getting rid of WrappedError 2015-08-21 11:50:02 -04:00
Steve Streeting
dadeb342c2 First pass of fetching recent commits 2015-08-21 15:19:16 +01:00
Steve Streeting
75a911503e Fix error 2015-08-21 15:18:26 +01:00
Steve Streeting
39676192da Make ref resolution return a complete Ref rather than just SHA, & test 2015-08-20 15:36:10 +01:00
Steve Streeting
87582763a6 Add "--recent" fetch option & update docs 2015-08-18 10:12:02 +01:00
rubyist
e5d3fcec8b Display errors when fetching 2015-08-17 15:45:43 -06:00
risk danger olson
4457d7c7c5 Merge pull request #578 from billygor/major-pre-push-optimization-for-current-remote
major pre-push optimization (alternative: look for deltas against current remote only)
2015-08-17 14:01:21 -06:00
risk danger olson
78d208caed Merge pull request #583 from sinbad/fetch-pull-remote-args
Add optional remote arg to fetch & pull, and default to tracking remote
2015-08-17 13:59:54 -06:00
risk danger olson
0f63d9b600 Merge pull request #573 from sinbad/fetch-include-exclude
Add include/exclude config options & params to fetch
2015-08-17 13:59:24 -06:00
Billy Gor
f3bf4ea90b major pre-push optimization
this change improves drastically pre-push behaviour, by not sending
lfs objects which are already on a remote. Works perfectly with
pushing new branches and tags.

currently pre-push command analyse "local sha1" vs "remote sha1" of the
ref being pushed and if "remote sha1" is available locally tries to send
only lfs objects introduced with new commits.

why this is broken:
- remote branch might have moved forward (local repo is not up to date).
  In this case you have no chance to isolate new lfs objects ("remote sha1"
  does not exist locally) and git-lfs sends everything from the local
  branch history.
- remote branch does not exist (or new tag is pushed). Same consequences.

But what is important - local repository always have remote references,
from which user created his local branch and started making some local
changes. So, all we have to do is to identify new lfs objects which do
not exist on remote references. And all this can be easily achieved with
the same all mighty git rev-list command.

This change makes git-lfs usable with gerrit, where changes are uploaded
by using magic gerrit branches which does not really exist. i.e.
git push origin master:refs/for/master

in this case "refs/for/master" does not exist and git feeds all 0-s as
"remote sha1".
2015-08-17 10:59:08 +02:00
risk danger olson
5214daa46b Merge pull request #585 from github/sinbad-pre-push-exit-code
Extend #582 with more tests
2015-08-14 10:00:34 -06:00
risk danger olson
179224c9f9 Merge pull request #581 from sinbad/pre-push-missing-local-present-server
Check server for objects before failing push because local is missing
2015-08-14 08:52:42 -06:00
Steve Streeting
dc71cb1c8d Incorporate panic prevention from PR #570 to avoid merge conflicts 2015-08-14 10:33:00 +01:00
Rick Olson
5b7990ce92 teach the init command how to update pre-push hooks with force
This reuses the update command completely.
2015-08-13 17:13:00 -06:00
Rick Olson
87b557d75b teach the upgrade command how to update pre-push hooks 2015-08-13 17:12:17 -06:00
Steve Streeting
b5df63c071 Add optional remote arg to fetch & pull, and default to tracking remote
The first arg to fetch & pull is now a remote. In addition, the default
remote if you don't specify is now the tracking remote as in `git pull`
if it exists, and origin if that's not set. This makes it more consistent
with the underlying git workflow especially in triangular fork setups.
2015-08-13 17:22:29 +01:00
Steve Streeting
a7d0a36ecb Re-use code between DownloadCheckable and Downloadable
Renamed Checkable to DownloadCheckable because it only applies to download,
upload checks differently and uses different struct fields. Incorporated
with download_queue.go since code is now smaller & common.
2015-08-13 09:33:01 +01:00
Steve Streeting
a94e2a9937 Change the approach, listen on q.Watch() instead since errors not reliable in batch mode
In batch mode you don't get an error from a missing Check(), you just get
a lack of download link (get an upload link instead). Therefore the only
reliable way to judge whether Check() worked is to check the transfer chan.

Also add tests for batch mode to prove this works
2015-08-12 17:36:40 +01:00
Steve Streeting
9f54872176 Rename verify_queue to check_queue to eliminate ambiguity 2015-08-12 11:41:54 +01:00
Steve Streeting
d8a7fb0f3b Make error reporting consistent with previous so tests pass 2015-08-12 11:21:41 +01:00
Steve Streeting
92ef7a1f14 Working on using a VerifyQueue to check oid server presence without downloading 2015-08-11 18:07:41 +01:00
Steve Streeting
bf8bade4cf Don't download on smudge if file is filtered by include/exclude config 2015-08-10 17:00:10 +01:00
Steve Streeting
6f847ea527 Do not call update-index until we know we have 1 file to give it as an arg
If we close down the update-index process without having given it any
args in stdin, then it applies to the whole working copy and has unwanted
side effects e.g. calling clean/smudge filters.
2015-08-10 17:00:10 +01:00
Steve Streeting
451b03edf9 Adding --include and --exclude args to fetch/pull 2015-08-10 17:00:10 +01:00
Steve Streeting
4675404f33 Add lfs.fetchinclude and lfs.fetchexclude gitconfig options
These include or exclude lists of paths (matching as per gitignore) in
the fetch to optimise downloading.
2015-08-10 17:00:10 +01:00
rubyist
e9092641a9 The loop that feeds git update-index MUST NOT panic 2015-08-07 15:35:43 -04:00
rubyist
711f483767 Don't use make here
When using make with append, both a capacity and length must be used in
the make call. If only the length is used the array will have len zero
values at the beginning and append will start adding values at the end.
This is a small number of values so just skip make altogether.
2015-08-07 15:00:27 -04:00
Steve Streeting
e0e56caccd Never download anything when using the checkout command
This was always the intention but the PointerSmudge functions would
automatically do it if the local files were missing. Now they take a
boolean argument to say whether to download or not, and the case of
skipped smudge is dealt with by writing out the original pointer data
and returning a known non-fatal error.
2015-08-06 17:12:11 +01:00