| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
When the fetch refspec does not include the remote's default branch, it
indicates an error in user expectations or programmer error. Error out
in that case.
This lets us get rid of the dummy refspec which can never work as its
zeroed out. In the cases where we did not find a default branch, we set
HEAD detached immediately, which lets us refactor the "normal" path,
removing `found_branch`.
|
|
|
|
|
| |
If the remote does not advertise HEAD, then it is unborn and we cannot
checkout that branch. Handle it the same way as an empty repo.
|
|
|
|
|
|
|
| |
A repository can have any number of references which we're not
interested in such as notes or tags. For the default branch calculation
we only care about branches. Make the decision about the number of
branches rather than the number of refs in general.
|
|\
| |
| | |
Compatibility/Portability cleanup
|
| | |
|
| | |
|
|/
|
|
|
| |
Windows can't handle a path like `/c:/foo`; when turning file:///
URIs into local paths, we must strip the leading slash.
|
|
|
|
|
|
| |
As git_clone now has callbacks to configure the details of the
repository and remote, remove the lower-level functions from the public
API, as they lack some of the logic from git_clone proper.
|
|
|
|
|
|
| |
Analogously to the remote creation callback, provide a way for the user
of git_clone() to create the repository with whichever options they
desire via callback.
|
|
|
|
|
| |
git_remote_set_transport now takes a transport factory rather than a transport
git_clone_options now allows the caller to specify a remote creation callback
|
|
|
|
|
|
| |
Whe already worked out the kinks with the function used in the local
transport. Expose it and make use of it in the local clone method
instead of trying to work it out again.
|
|
|
|
|
|
|
|
| |
If requested, git_clone_local_into() will try to link the object files
instead of copying them.
This only works on non-Windows (since it doesn't have this) when both
are on the same filesystem (which are unix semantics).
|
| |
|
| |
|
|
|
|
|
|
|
| |
A call like git_clone("./foo", "./foo1") writes origin's url as './foo',
which makes it unusable, as they're relative to different things.
Go with git's behaviour and store the realpath as the url.
|
|
|
|
|
|
|
|
| |
When git is given such a path, it will perform a "local clone",
bypassing the git-aware protocol and simply copying over all objects
that exist in the source.
Copy this behaviour when given a local path.
|
|
|
|
|
|
|
| |
We have too many places where we repeat free code, so when adding the
new free to the generic code, it didn't take for the local transport.
While there, fix a C99-ism that sneaked through.
|
|
|
|
|
| |
Since we no longer need to push data to callbacks, there's no need for
this truct.
|
|
|
|
|
| |
Let's use the remote's default branch guessing instead of reinventing
one ourselves with callbacks.
|
|
|
|
|
| |
A recently added check might skip initialization of old_fetchhead and go
directly to cleanup. So, destruct in the opposite order of construction.
|
|
|
|
|
|
|
|
|
| |
We set up the current branch after we fetch from the remote. This means
that the user's refspec may have already created this reference. It is
therefore not an error if we cannot create the branch because it already
exists.
This allows for the user to replicate git-clone's --mirror option.
|
|
|
|
|
|
| |
Instead of changing the user-provided remote, duplicate it so we can add
the extra refspec without having to worry about unsetting it before
returning.
|
|
|
|
|
| |
Use an unsigned int for the version and add a helper macro so the
code is simplified (and so the error message is a common string).
|
| |
|
| |
|
|
|
|
| |
The basic structure of each function is courtesy of arrbee.
|
|
|
| |
Also added a test for git_remote_fetch.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Clone callbacks can return non-zero values to cancel the clone.
This adds some tests to verify that this actually works and updates
the documentation to be clearer that this can happen and that the
return value will be propagated back by the clone function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the behavior of callbacks so that the callback error
code is not converted into GIT_EUSER and instead we propagate the
return value through to the caller. Instead of using the
giterr_capture and giterr_restore functions, we now rely on all
functions to pass back the return value from a callback.
To avoid having a return value with no error message, the user
can call the public giterr_set_str or some such function to set
an error message. There is a new helper 'giterr_set_callback'
that functions can invoke after making a callback which ensures
that some error message was set in case the callback did not set
one.
In places where the sign of the callback return value is
meaningful (e.g. positive to skip, negative to abort), only the
negative values are returned back to the caller, obviously, since
the other values allow for continuing the loop.
The hardest parts of this were in the checkout code where positive
return values were overloaded as meaningful values for checkout.
I fixed this by adding an output parameter to many of the internal
checkout functions and removing the overload. This added some
code, but it is probably a better implementation.
There is some funkiness in the network code where user provided
callbacks could be returning a positive or a negative value and
we want to rely on that to cancel the loop. There are still a
couple places where an user error might get turned into GIT_EUSER
there, I think, though none exercised by the tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This continues auditing all the places where GIT_EUSER is being
returned and making sure to clear any existing error using the
new giterr_user_cancel helper. As a result, places that relied
on intercepting GIT_EUSER but having the old error preserved also
needed to be cleaned up to correctly stash and then retrieve the
actual error.
Additionally, as I encountered places where error codes were not
being propagated correctly, I tried to fix them up. A number of
those fixes are included in the this commit as well.
|
|
|
|
|
|
|
|
|
|
|
| |
The callback-based method of listing remote references dates back to the
beginning of the network code's lifetime, when we didn't know any
better.
We need to keep the list around for update_tips() after disconnect() so
let's make use of this to simply give the user a pointer to the array so
they can write straightforward code instead of having to go through a
callback.
|
|
|
|
|
|
| |
Removing arbitrary refspecs makes things more complex to reason
about. Instead, let the user set the fetch and push refspec list to
whatever they want it to be.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This hooks up git_path_direach and git_path_dirload so that they
will take a flag indicating if directory entry names should be
tested and converted from decomposed unicode to precomposed form.
This code will only come into play on the Apple platform and even
then, only when certain types of filesystems are used.
This involved adding a flag to these functions which involved
changing a lot of places in the code.
This was an opportunity to do a bit of code cleanup here and there,
for example, getting rid of the git_futils_cleanupdir_r function in
favor of a simple flag to git_futils_rmdir_r to not remove the top
level entry. That ended up adding depth tracking during rmdir_r
which led to a safety check for infinite directory recursion. Yay.
This hasn't actually been tested on the Mac filesystems where the
issue occurs. I still need to get test environment for that.
|
|
|
|
| |
There's no need for this to be a pointer to somewhere else.
|
|
|
|
| |
This wasremoved as part of the large culling a few commits ago.
|
|
|
|
|
| |
This is a small thing that by itself doesn't quite justify making the
user use clone_into.
|
|
|
|
|
| |
The removal of many options which lead to the direct usage of the
user's checkout options means we should make sure they remain const.
|
|
|
|
|
| |
This used to be done via transport flags, which was removed in a
previous commit.
|
|
|
|
|
|
| |
The basic clone function is there to make it easy to create a "normal"
clone. Remove a bunch of options that are about changing the remote's
configuration.
|
|
|
|
| |
Unify the code bases.
|
|
|
|
|
| |
Downloading all tags is part of what makes it a clone instead of
simply a fetch.
|
| |
|
|
|
|
|
| |
This allows you to set up the repository and remote as you which to
have them before performing the clone operation.
|
|
|
|
|
| |
Move this one as well, letting us have a single way of setting the
callbacks for the remote, and removing fields from the clone options.
|
|
|
|
|
|
| |
The text progress and update_tips callbacks are already part of the
struct, which was meant to unify the callback setup, but the download
one was left out.
|