Commit Graph

8189 Commits

Author SHA1 Message Date
Carlos Martín Nieto
edef91ee25 fileops: set an error on write error for file copy
We set an error if we get an error when reading, but we don't bother
setting an error message for write failing. This causes a cryptic error
to be shown to the user when the target filesystem is full.
2015-05-17 15:48:33 +02:00
Carlos Martín Nieto
54738368ec fileops: set an error message if we fail to link a file
Now that `git_path_direach` lets us specify an error message to report,
set an appropriate error message while linking.
2015-05-15 12:18:05 +02:00
Carlos Martín Nieto
8a4d77f990 path: don't let direach overwrite the callback's error message
This function deals with functions doing IO which means the amount of
errors that can happen is quit large. It does not help if it always
ovewrites the underlying error message with a less understandable
version of "something went wrong".

Instead, only use this generic message if there was no error set by the
callback.
2015-05-15 12:15:45 +02:00
Carlos Martín Nieto
9042693e28 Merge pull request #3130 from mortonfox/patch-1
Updated dlibgit link.
2015-05-15 10:10:24 +02:00
Carlos Martín Nieto
481ac3d1b3 Merge pull request #3129 from Therzok/patch-2
Bring Early EOF message in line with the other two
2015-05-14 21:51:45 +02:00
Morton Fox
e702dc2e24 Updated dlibgit link. 2015-05-14 15:49:51 -04:00
Marius Ungureanu
7e9a240e0a Make "Early EOF" message start with lowercase 2015-05-14 21:39:52 +03:00
Carlos Martín Nieto
542a7de0cd local: plug a leak in the progress reporting 2015-05-14 17:26:09 +02:00
Edward Thomson
4a6a67461d Merge pull request #3128 from libgit2/cmn/push-notify-deleted
Add tests for and fix push negotiation notification
2015-05-14 09:10:20 -04:00
Carlos Martín Nieto
254ff3e929 push: fix the update constructor
There was a copypasta error and the source and destination IDs were
reversed.
2015-05-14 10:34:42 +02:00
Carlos Martín Nieto
041ad7dbd6 push: add tests for the push negotiation callback
The functionality was meged without including tests, so let's add them
now.
2015-05-14 10:34:05 +02:00
Carlos Martín Nieto
98270f56d1 Add CHANGELOG entry for index entry changes 2015-05-14 08:26:02 +02:00
Carlos Martín Nieto
16d742ebdb Merge pull request #3119 from ethomson/ignore
Attributes: don't match files for folders
2015-05-13 21:43:58 +02:00
Edward Thomson
cd430bc786 Merge pull request #3103 from libgit2/cmn/local-push-message
Use the packbuilder in local push
2015-05-13 14:26:20 -04:00
Edward Thomson
2ec73fa9ed Merge pull request #3102 from libgit2/cmn/pack-objects-report
Show progress during packing for the local transport
2015-05-13 14:26:06 -04:00
Edward Thomson
a6f2ceaf48 Merge pull request #3118 from libgit2/cmn/stream-size
odb: make the writestream's size a git_off_t
2015-05-13 12:11:55 -04:00
Edward Thomson
882cc37f83 attr tests: make explicit our dir/file match tests 2015-05-13 10:56:55 -04:00
Carlos Martín Nieto
3e529e9d2d Fix a few leaks
The interesting one is the notification macro, which was returning
directly on a soft-abort instead of going through the cleanup.
2015-05-13 16:40:18 +02:00
Carlos Martín Nieto
3c337a5d37 packbuilder: report progress during deltification
This is useful to send to the client while we're performing the work.

The reporting function has a force parameter which makes sure that we
do send out the message of 100% completed, even if this comes before the
next udpate window.
2015-05-13 15:52:13 +02:00
Carlos Martín Nieto
8cec2b8ae9 local: send the packbuilder progress via the sideband
Set a callback for the packbuilder so we can send the sideband messages
to the caller, formatting them as git would.
2015-05-13 15:52:13 +02:00
Carlos Martín Nieto
cf66c4748c examples: show the sideband progress on clone
This lets us see what the server (or libgit2 locally) is doing, rather
than having to stare at a non-moving screen.
2015-05-13 15:52:12 +02:00
Edward Thomson
d01737b419 Merge pull request #3117 from libgit2/cmn/index-more-accurate
index: make the entries have more accurate sizes
2015-05-13 09:11:38 -04:00
Edward Thomson
b0c4b6420c Merge pull request #3116 from libgit2/cmn/remove-ssh-embed
Get rid of libssh2 embedding
2015-05-13 09:11:18 -04:00
Edward Thomson
6cd9219385 Merge pull request #3115 from libgit2/cmn/clone-submodule
submodule: add test initialising and cloning a repo
2015-05-13 09:07:15 -04:00
Edward Thomson
a3ff28e9d1 Merge pull request #3120 from libgit2/cmn/backends-prio
odb: reverse the default backend priorities
2015-05-13 09:02:00 -04:00
Carlos Martín Nieto
0bc3d56dde tests: don't push to our resources
A couple of tests use the wrong remote to push to. We did not notice up
to now because the local push would copy individual objects, and those
already existed, so it became a no-op.

Once we made local push create the packfile, it became noticeable that
there was a new packfile where it didn't belong.
2015-05-13 10:56:37 +02:00
Carlos Martín Nieto
4a5b781a48 local: use the packbuilder to push
Instead of copying each object individually, as we'd been doing, use the
packbuilder which should be faster and give us some feedback.

While performing this change, we can hook up the packbuilder's writing
to the push progress so the caller knows how far along we are.
2015-05-13 10:56:37 +02:00
Carlos Martín Nieto
81c0fb08bd local: add clarification for non-bare push restriction 2015-05-13 10:50:38 +02:00
Carlos Martín Nieto
c5c5cdb106 Merge pull request #3066 from libgit2/cmn/remote-less-state
Remove the configuration state we keep in the remote
2015-05-13 10:47:13 +02:00
Carlos Martín Nieto
b0d7f329a8 odb: reverse the default backend priorities
We currently first look in the loose object dir and then in the packs
for objects. When performing operations on recent history this has a
higher likelihood of hitting, but when we deal with operations which
look further back into the past, we start spending a large amount of
time getting ENOTENT from `access`.

Reversing the priorities means that long-running operations can get to
their objects faster, as we can look at the index data we have in memory
(or rather mapped) to figure out whether we have an object, which is
faster than going out to the filesystem.

The packed backend already implements an optimistic read algorithm by
first looking at the packs we know about and only going out to disk to
referesh if the object is not found which means that in the case where
we do have the object (which will be in the majority for anything that
traverses the graph) we can avoid going to to disk entirely to determine
whether an object exists.

Operations which look at recent history may take a slight impact, but
these would be operations which look a lot less at object and thus take
less time regardless.
2015-05-13 10:23:19 +02:00
Carlos Martín Nieto
3251972e1f push: free the update list 2015-05-13 09:46:57 +02:00
Carlos Martín Nieto
b1ae3e5317 Update CHANGELOG with the changes to the remotes 2015-05-13 09:46:57 +02:00
Carlos Martín Nieto
3e20154a9d remote: simplify anonymous creation
We're down to simply having it be a call to create_internal() so let's
simply do that. The rest of the code is just a distraction.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
a4b6452a6a remote: remove git_remote_save()
It has now become a no-op, so remove the function and all references to
it.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
7725499072 remote: remove live changing of refspecs
The base refspecs changing can be a cause of confusion as to what is the
current base refspec set and complicate saving the remote's
configuration.

Change `git_remote_add_{fetch,push}()` to update the configuration
instead of an instance.

This finally makes `git_remote_save()` a no-op, it will be removed in a
later commit.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
3fec548a98 examples: adjust to the new remote API 2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
35a8a8c546 remote: move the tagopt setting to the fetch options
This is another option which we should not be keeping in the remote, but
is specific to each particular operation.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
3eff2a5728 remote: move the update_fetchhead setting to the options
While this will rarely be different from the default, having it in the
remote adds yet another setting it has to keep around and can affect its
behaviour. Move it to the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
058b753ceb remote: move the transport ctor to the callbacks
Instead of having it set in a different place from every other callback,
put it the main structure. This removes some state from the remote and
makes it behave more like clone, where the constructors are passed via
the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
6fb373a0e8 remote: add prune option to fetch
Add a prune setting in the fetch options to allow to fall back to the
configuration (the default) or to set it on or off.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
22261344de remote: remove url and pushurl from the save logic
As a first step in removing the repository-saving logic, don't allow
chaning the url or push url from a remote object, but change the
configuration on the configuration immediately.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
8f0104ecc5 Remove the callbacks struct from the remote
Having the setting be different from calling its actions was not a great
idea and made for the sake of the wrong convenience.

Instead of that, accept either fetch options, push options or the
callbacks when dealing with the remote. The fetch options are currently
only the callbacks, but more options will be moved from setters and
getters on the remote to the options.

This does mean passing the same struct along the different functions but
the typical use-case will only call git_remote_fetch() or
git_remote_push() and so won't notice much difference.
2015-05-13 09:46:35 +02:00
Carlos Martín Nieto
0525911442 push: remove own copy of callbacks
The push object knows which remote it's associated with, and therefore
does not need to keep its own copy of the callbacks stored in the
remote.

Remove the copy and simply access the callbacks struct within the
remote.
2015-05-13 09:46:35 +02:00
Carlos Martín Nieto
77b339f7b6 odb: make the writestream's size a git_off_t
Restricting files to size_t is a silly limitation. The loose backend
writes to a file directly, so there is no issue in using 63 bits for the
size.

We still assume that the header is going to fit in 64 bytes, which does
mean quite a bit smaller files due to the run-length encoding, but it's
still a much larger size than you would want Git to handle.
2015-05-13 09:34:20 +02:00
Edward Thomson
34593aaec0 attr: declare variable at top of block for msvc 2015-05-12 17:00:35 -04:00
Edward Thomson
90997e405d attr: less path mangling during attribute matching
When handling attr matching, simply compare the directory path where the
attribute file resides to the path being matched.  Skip over commonality
to allow us to compare the contents of the attribute file to the remainder
of the path.

This allows us to more easily compare the pattern directly to the path,
instead of trying to guess whether we want to compare the path's basename
or the full path based on whether the match was inside a containing
directory or not.

This also allows us to do fewer translations on the pattern (trying to
re-prefix it.)
2015-05-12 16:22:31 -04:00
Edward Thomson
9465bedb09 attr: don't mangle file path during attr matching
When determining whether some file matches an attr pattern, do
not try to truncate the path to pass to fnmatch.  When there is
no containing directory for an item (eg, from a .gitignore in the
root) this will cause us to truncate our path, which means that
we cannot do meaningful comparisons on it and we may have false
positives when trying to determine whether a given file is actually
a file or a folder (as we have lost the path's base information.)

This mangling was to allow fnmatch to compare a directory on disk to
the name of a directory, but it is unnecessary as our fnmatch accepts
FNM_LEADING_DIR.
2015-05-12 16:02:18 -04:00
Edward Thomson
30e629a073 attr: always return errors 2015-05-12 14:39:49 -04:00
Edward Thomson
ef6d072236 attr: don't match files for folders
When ignoring a path "foo/", ensure that this is actually a directory,
and not simply a file named "foo".
2015-05-12 14:36:52 -04:00
Edward Thomson
9486d20336 attr test: test a file beneath ignored folder 2015-05-12 14:36:48 -04:00