Commit Graph

7336 Commits

Author SHA1 Message Date
Jacques Germishuys
cde32d4d28 Variadic macros is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
Jacques Germishuys
ab864e9c71 _stat64 is a function, __stat64 is the structure 2014-07-06 09:22:24 +02:00
Jacques Germishuys
b8365f2168 strnlen() is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
Jacques Germishuys
90c2b37fd7 in_addr is defined in <Winsock2.h>, include before <ws2tcpip.h> 2014-07-06 09:22:24 +02:00
Vicent Marti
9b87998c97 Merge remote-tracking branch 'origin/cmn/update-zlib' 2014-07-04 18:49:24 +02:00
Carlos Martín Nieto
9fef46deaf Add a CHANGELOG entry for refspecs with asterisk in the middle 2014-07-04 18:00:20 +02:00
Carlos Martín Nieto
f5287fa6c3 refspec: support asterisks in the middle of a pattern
We used to assume a refspec would only have an asterisk in the middle of
their respective pattern. This has not been a valid assumption for some
time now with git.

Instead of assuming where the asterisk is going to be, change the logic
to treat each pattern as having two halves with a replacement bit in the
middle, where the asterisk is.
2014-07-04 18:00:20 +02:00
Carlos Martín Nieto
9ed104a8fa refspec: short-circuit non-pattern refspecs on transform
When transforming a non-pattern refspec, we simply need to copy over the
opposite string. Move that logic up to the wrapper so we can assume a
pattern refspec in the transformation function.
2014-07-04 17:41:40 +02:00
Carlos Martín Nieto
98ce2318c8 Merge pull request #2461 from jacquesg/ssh2-warnings
Fix SSH2 warnings
2014-07-04 09:18:01 +02:00
Jacques Germishuys
ae241ae129 Include libssh2.h before git2.h (transport.h) 2014-07-03 20:20:00 +02:00
Jacques Germishuys
268dafa260 Fix git_cred_ssh_interactive_callback signature 2014-07-03 20:19:16 +02:00
Vicent Marti
b0ed61f822 Merge pull request #2460 from libgit2/cmn/sched-yield
Move yield to the tests and enable for FreeBSD
2014-07-03 15:30:38 +02:00
Carlos Martín Nieto
905fb5929b Move yield to the tests and enable for FreeBSD
Move the definition of git_thread_yield() to the test which needs it and
add the correct definition for it for FreeBSD and derivatives.

Original patch adding FreeBSD and derivatives by @jacquesg.
2014-07-03 05:55:02 +02:00
Vicent Marti
193fe9cbbf Merge pull request #2459 from libgit2/cmn/http-url-path
netops: error out on url without a path
2014-07-03 02:41:10 +02:00
Carlos Martín Nieto
1380e7c6b1 netops: error out on url without a path
In order to connect to a remote server, we need to provide a path to the
repository we're interested in. Consider the lack of path in the url an
error.
2014-07-03 02:34:32 +02:00
Vicent Marti
cb6e68c7e6 Merge pull request #2449 from libgit2/cmn/maint-21
Maint fixes for ssl initing and ssh exposure
2014-07-02 16:45:02 +02:00
Vicent Marti
c1bf2942fc Merge pull request #2455 from ethomson/equal_oid
Introduce `cl_assert_equal_oid`
2014-07-02 15:29:25 +02:00
Vicent Marti
4df4ebd7c7 Merge pull request #2453 from ethomson/checkout_index
git_checkout_index: checkout other indexes
2014-07-02 15:29:14 +02:00
Vicent Marti
b0ca1b18e2 Merge pull request #2452 from libgit2/cmn/clone-custom-repo
Provide a callback to customize the repository on clone
2014-07-02 15:29:05 +02:00
Vicent Marti
de3cf801ce Merge pull request #2456 from libgit2/cmn/ssh-send-everything
ssh: libssh2_channel_write() behaves like send()
2014-07-02 15:28:24 +02:00
Carlos Martín Nieto
0963716b3f ssh: libssh2_channel_write() behaves like send()
When the stream writing function was written, it assume that
libssh2_channel_write() would always write all of the data to the
wire. This is only true for the first 32k of data, which it tries to
fit into one ssh packet.

Since it can perform short writes, call it in a loop like we do for
send(), advancing the buffer offset.
2014-07-02 12:49:51 +02:00
Carlos Martín Nieto
6812afaf38 clone: remote git_clone_into{,_local} from the public API
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.
2014-07-02 07:05:00 +02:00
Carlos Martín Nieto
d58a64e9a5 clone: add a callback for repository creation
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.
2014-07-02 07:05:00 +02:00
Edward Thomson
967f5a76b1 git_checkout_index: checkout other indexes
git_checkout_index can now check out other git_index's (that are not
necessarily the repository index).  This allows checkout_index to use
the repository's index for stat cache information instead of the index
data being checked out.  git_merge and friends now check out their
indexes directly instead of trying to blend it into the running index.
2014-07-01 17:32:15 -04:00
Edward Thomson
9879fee184 revwalk::simplify test should test
The revwalk::simplify test was not actually tested the values from
the revwalk against the expected.  (Further, the expected had two
IDs transposed.)
2014-07-01 14:40:16 -04:00
Edward Thomson
0cee70ebb7 Introduce cl_assert_equal_oid 2014-07-01 14:40:16 -04:00
Vicent Marti
1453bd2089 Merge pull request #2451 from libgit2/rb/round-up-pool-allocations
Round up pool alloc sizes for alignment
2014-07-01 13:26:02 +02:00
Carlos Martín Nieto
00b8c216c2 ssh: always declare the libssh2 types
This lets a user decide they do want to use keyboard-interactive after
they've compiled.
2014-06-30 23:27:20 +02:00
Russell Belfer
5fa8cda981 Round up pool alloc sizes for alignment
To make sure that items returned from pool allocations are aligned
on nice boundaries, this rounds up all pool allocation sizes to a
multiple of 8.  This adds a small amount of overhead to each item.

The rounding up could be made optional with an extra parameter to
the pool initialization that turned on rounding only for pools
where item alignment actually matters, but I think for the extra
code and complexity that would be involved, that it makes sense
just to burn a little bit of extra memory and enable this all the
time.
2014-06-30 12:05:25 -07:00
Vicent Marti
dcdb8500e3 Merge pull request #2440 from phkelley/transports
Improvements to git_transport extensibility
2014-06-30 17:35:42 +02:00
Carlos Martín Nieto
eac63e6754 ssh: create the right callback signature based on build options
When linking against libssh2, create the transport.h such that it
contains its definition for custom crypto and keyboard-interactive
callbacks.

If we don't link against libssh2, create an equivalent signature which
has void pointers instead of pointers to libssh2 structures.

This would be one way to fix #2438.
2014-06-30 10:03:36 +02:00
Carlos Martín Nieto
e6b0ae7a13 ssl: init only once without threads
The OpenSSL library-loading functions do not expect to be called
multiple times. Add a flag in the non-threaded libgit2 init so we only
call once.

This fixes #2446.
2014-06-30 09:29:54 +02:00
Vicent Marti
16e7596d78 Merge pull request #2447 from phkelley/pkt_assert
Fix assert when receiving uncommon sideband packet
2014-06-27 18:11:06 +02:00
Philip Kelley
bc8a088685 Fix assert when receiving uncommon sideband packet 2014-06-27 12:03:27 -04:00
Philip Kelley
1697cd6ff5 Improvements to git_transport extensibility
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
2014-06-26 22:34:37 -04:00
Carlos Martín Nieto
8733993599 travis: enable password authentication on OSX
Our ssh tests assume that the server supports password authentication
in a few places. This is convenient as we're not testing authentication
methods, but what happens around them.

Tell sshd on OSX to accept this form of authentication.
2014-06-26 22:58:39 +02:00
Carlos Martín Nieto
e26b08d32c ssh: adjust clone and push test credentials to the split user+pass method
For urls where we do not specify a username, we must handle the case
where the ssh transport asks us for the username.

Test also that switching username fails.
2014-06-26 22:58:39 +02:00
Carlos Martín Nieto
ccb85c8fa1 ssh: make sure to ask for a username and use the same one
In order to know which authentication methods are supported/allowed by
the ssh server, we need to send a NONE auth request, which needs a
username associated with it.

Most ssh server implementations do not allow switching the username
between authentication attempts, which means we cannot use a dummy
username and then switch. There are two ways around this.

The first is to use a different connection, which an earlier commit
implements, but this increases how long it takes to get set up, and
without knowing the right username, we cannot guarantee that the
list we get in response is the right one.

The second is what's implemented here: if there is no username specified
in the url, ask for it first. We can then ask for the list of auth
methods and use the user's credentials in the same connection.
2014-06-26 22:58:39 +02:00
Carlos Martín Nieto
d1c281a552 cred: add convenience function to get the username
Since each cred defines the username on their own, introduce
git_cred__username to retrieve the username pointer from them.
2014-06-26 22:58:38 +02:00
Carlos Martín Nieto
54da69588e cred: introduce username-only cred
This exists as ssh needs to know about the username to use before it can
query for the supported authentication methods.
2014-06-26 22:58:38 +02:00
Carlos Martín Nieto
d7f962f408 ssh: request credentials again on authentication failure
Instead of completely giving up on the first failure, ask for
credentials as long as we fail to authenticate.
2014-06-26 22:58:38 +02:00
Carlos Martín Nieto
8873728f37 Introduce GIT_EAUTH
Introduce this error code to signal an authentication failure.
2014-06-26 22:58:38 +02:00
Vicent Marti
0145afe635 Merge pull request #2445 from ethomson/checkout_conflict_test
checkout::conflict tests: only test owner mode
2014-06-26 18:24:13 +02:00
Edward Thomson
f4046267dc checkout::conflict tests: only test owner mode
The checkout::conflict type conflict tests were failing because
they were overly assertive about the resultant mode, testing
group & other bits, which failed miserably for people who had a
umask less restrictive than 022.  Only test the resultant owner bits.
2014-06-26 09:16:12 -04:00
Philip Kelley
9c46409d38 Merge pull request #2444 from libgit2/phkelley/flexarray
Fixes #2443 Zero size arrays are an extension
2014-06-26 08:01:01 -04:00
Philip Kelley
f36d57b9bf Fixes #2443 Zero size arrays are an extension 2014-06-26 07:48:09 -04:00
Vicent Marti
86cb34cb11 Merge pull request #2442 from libgit2/cmn/leaks
Fix a couple of leaks
2014-06-25 21:43:52 +02:00
Carlos Martín Nieto
c19b1c0442 pack: clean up error returns
Set a message when we fail to lock.

Also make the put function void, since it's called from free, which
cannot report errors. The only errors we can experience here are
internal state corruption, so we assert that we are trying to put a
pack which we have previously got.
2014-06-25 21:35:58 +02:00
Carlos Martín Nieto
966fb20702 tree: free in error conditions
As reported by coverity, we would leak some memory in error conditions.
2014-06-25 21:25:44 +02:00
Carlos Martín Nieto
5e0f47c375 pack: free the new pack struct if we fail to insert
If we fail to insert the packfile in the map, make sure to free it.

This makes the free function only attempt to remove its mwindows from
the global list if we have opened the packfile to avoid accessing the
list unlocked.
2014-06-25 21:20:39 +02:00