| Commit message (Collapse) | Author | Age | Files | Lines |
| |\
| |
| |
| |
| | |
Conflicts:
src/revparse.c
|
| | | |
|
| |/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libgit2 has two distinct requirements that were previously solved by
`git_buf`. We require:
1. A general purpose string class that provides a number of utility APIs
for manipulating data (eg, concatenating, truncating, etc).
2. A structure that we can use to return strings to callers that they
can take ownership of.
By using a single class (`git_buf`) for both of these purposes, we have
confused the API to the point that refactorings are difficult and
reasoning about correctness is also difficult.
Move the utility class `git_buf` to be called `git_str`: this represents
its general purpose, as an internal string buffer class. The name also
is an homage to Junio Hamano ("gitstr").
The public API remains `git_buf`, and has a much smaller footprint. It
is generally only used as an "out" param with strict requirements that
follow the documentation. (Exceptions exist for some legacy APIs to
avoid breaking callers unnecessarily.)
Utility functions exist to convert a user-specified `git_buf` to a
`git_str` so that we can call internal functions, then converting it
back again.
|
| |
|
|
|
|
|
| |
Using a callback to set a resolve_url is not particularly idiomatic.
Deprecate it in favor of the `set_instance_url` and
`set_instance_pushurl` functions which can now be called from the
`git_remote_ready_cb` callback.
|
| |
|
|
| |
Introduce a new callback that fires when the remote is ready to connect.
|
| |
|
|
|
|
| |
Users may want to override the URL on a particular instance of a remote,
instead of updating the configuration. Previously, users could use a
callback to do this, but this is not particularly idiomatic.
|
| | |
|
| |
|
|
|
|
| |
We _dispose_ the contents of objects; we _free_ objects (and their
contents). Update `git_strarray_free` to be `git_strarray_dispose`.
`git_strarray_free` remains as a deprecated proxy function.
|
| |
|
|
|
|
|
|
|
|
| |
The code worked under the assumption that anything under `refs/tags` are
tag objects, and all the rest would be peelable to a commit. As it is
completely valid to have tags to blobs under a non `refs/tags` ref, this
would cause failures when trying to peel a tag to a commit.
Fix the broken filtering by switching to `git_revwalk_push_glob`, which
already handles this case.
|
| |
|
|
|
|
| |
Since libssh2 doesn't read host configuration from the config file,
this callback can be used to hand over URL resolving to the client
without touching the SSH implementation itself.
|
| |
|
|
|
| |
Move to the `git_error` name in the internal API for error-related
functions.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
A newly added test uses the `git_repository_new` function without the
corresponding header file being included. While this works due to the
compiler deducing the correct function signature, we should obviously
just include the function's declaration file.
|
| |
|
|
|
| |
Given a wholly in-memory repository, ensure that we can create an
anonymous remote and perform actions on it.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
When we moved from acting on the instance to acting on the
configuration, we dropped the validation of the passed refspec, which
can lead to writing an invalid refspec to the configuration. Bring that
validation back.
|
| |
|
|
|
|
| |
An anonymous remote is not configured and cannot therefore have
configured refspecs. Remove the parameter which adds this from the
constructor.
|
| |
|
|
|
| |
The functionality was meged without including tests, so let's add them
now.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
It has now become a no-op, so remove the function and all references to
it.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
This is another option which we should not be keeping in the remote, but
is specific to each particular operation.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Moved offending tests from network to online so they will get skipped
when there is a lack of network connectivity:
-test_online_remotes__single_branch
-test_online_remotes__restricted_refspecs
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the get_entry() method to return a refcounted version of
the config entry, which you have to free when you're done.
This allows us to avoid freeing the memory in which the entry is stored
on a refresh, which may happen at any time for a live config.
For this reason, get_string() has been forbidden on live configs and a
new function get_string_buf() has been added, which stores the string in
a git_buf which the user then owns.
The functions which parse the string value takea advantage of the
borrowing to parse safely and then release the entry.
|
| |
|
|
|
|
| |
We want to use the "checkout: moving from ..." message in order to let
git know when a change of branch has happened. Make the convenience
functions for this goal write this message.
|
| |
|
|
| |
We always use "update by push".
|
| |
|
|
|
|
|
|
|
|
| |
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.
In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
|
| |
|
|
|
| |
Instead we provide git_remote_upload() and git_remote_update_tips() in
order to have a parallel API for fetching and pushing.
|
| |
|
|
|
| |
The push cannot be successful if we sent a bad packfile. We should
return an error in that case instead of storing it elsewhere.
|
| | |
|
| | |
|
| |
|
|
| |
Valgrind is now clean except for libssl and libgcrypt.
|
| |\
| |
| | |
Fixed active_refspecs field not initialized on new git_remote objects
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
When creating a new remote, contrary to loading one from disk,
active_refspecs was not populated. This means that if using the new
remote to push, git_push_update_tips() will be a no-op since it
checks the refspecs passed during the push against the base ones
i.e. active_refspecs. And therefore the local refs won't be created
or updated after the push operation.
|
| |\ \
| |/
|/| |
push: use the common refspec parser
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There is one well-known and well-tested parser which we should use,
instead of implementing parsing a second time.
The common parser is also augmented to copy the LHS into the RHS if the
latter is empty.
The expressions test had to change a bit, as we now catch a bad RHS of a
refspec locally.
|
| | | |
|
| |\ \
| | |
| | | |
Refactor fetchhead
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If the remote is anonymous, then we cannot check for any configuration,
as there is no name. Check for this before we try to use the name, which
may be a NULL pointer.
This fixes #2697.
|
| |/ /
| |
| |
| | |
This brings it in line with the rest of the lookup functions.
|
| |\ \
| |/
|/| |
remote: check for the validity of the refspec when updating FETCH_HEAD
|