Commit Graph

9246 Commits

Author SHA1 Message Date
Patrick Steinhardt
80a834a5af index: assert required OID are non-NULL 2016-03-11 12:14:01 +01:00
Patrick Steinhardt
61d7328dc3 object: avoid call of memset with ouf of bounds pointer
When computing a short OID we do this by first copying the
leading parts into the new OID structure and then setting the
trailing part to zero. In the case of the desired length being
`GIT_OID_HEXSZ - 1` we will call `memset` with an out of bounds
pointer and a length of 0. While this seems to cause no problems
for common platforms the C89 standard does not explicitly state
that calling `memset` with an out of bounds pointer and
length of 0 is valid.

Fix the potential issue by using the newly introduced
`git_oid__cpy_prefix` function.
2016-03-11 12:14:01 +01:00
Patrick Steinhardt
35b7bca28b tests: transport: fix memory leaks with registering transports 2016-03-11 11:06:42 +01:00
Patrick Steinhardt
e756877dbf tests: nsec: correctly free nsec_path
git_buf_clear does not free allocated memory associated with a
git_buf. Use `git_buf_free` instead to correctly free its memory
and plug the memory leak.
2016-03-11 09:07:42 +01:00
Piet Brauer
0ac4a5ded4 Check for __CLANG_INTTYPES_H
This fixes an issue in Xcode 7.3 in objective-git where we get the error
"Include of non-modular header file in module". Not importing this
header again fixes the issue.
2016-03-11 10:33:37 +08:00
Patrick Steinhardt
e126bc95cd config_file: handle missing quotation marks in section header
When parsing a section header we expect something along the
format of '[section "subsection"]'. When a section is
mal-formated and is entirely missing its quotation marks we catch
this case by observing that `strchr(line, '"') - strrchr(line,
'"') = NULL - NULL = 0` and error out. Unfortunately, the error
message is misleading though, as we state that we are missing the
closing quotation mark while we in fact miss both quotation
marks.

Improve the error message by explicitly checking if the first
quotation mark could be found and, if not, stating that quotation
marks are completely missing.
2016-03-10 10:28:33 +01:00
Patrick Steinhardt
345758ad45 describe: handle error code returned by git_pqueue_insert 2016-03-10 10:28:32 +01:00
Carlos Martín Nieto
2ba9a0ddac Merge pull request #3623 from ethomson/rebase_with_commit
rebase: additional setup tests of exotic behavior
2016-03-09 23:45:33 +01:00
Carlos Martín Nieto
ac6f62dece Merge pull request #3672 from libgit2/cmn/do-fail-appveyor
appveyor: stop if the first test fails
2016-03-09 21:37:39 +01:00
Carlos Martín Nieto
113e16347d appveyor: stop if the first test fails 2016-03-09 19:20:38 +01:00
Edward Thomson
997c67da00 Merge pull request #3670 from libgit2/vmg/expand-fixes
Fixes for `gid_odb_expand_ids`
2016-03-09 18:12:34 +00:00
Vicent Marti
1bbcb2b279 odb: Try to lookup headers in all backends before passthrough 2016-03-09 18:17:37 +01:00
Vicent Marti
e78d2ac939 odb: Refactor git_odb_expand_ids 2016-03-09 16:43:43 +01:00
Vicent Marti
4416aa7749 odb: Implement new helper to read types without refreshing 2016-03-09 16:43:17 +01:00
Edward Thomson
084f2c4b41 Merge pull request #3668 from libgit2/cmn/mwindow-try-harder
mwindow: free unused windows if we fail to mmap
2016-03-09 14:51:13 +00:00
Carlos Martín Nieto
d50fd57174 mwindow: free unused windows if we fail to mmap
The first time may be due to memory fragmentation or just bad luck on a
32-bit system. When we hit the mmap error for the first time, free up
the unused windows and try again.
2016-03-09 11:16:16 +01:00
Vicent Marti
9a78665005 odb: Handle corner cases in git_odb_expand_ids
The old implementation had two issues:

1. OIDs that were too short as to be ambiguous were not being handled
properly.

2. If the last OID to expand in the array was missing from the ODB, we
would leak a `GIT_ENOTFOUND` error code from the function.
2016-03-09 11:00:27 +01:00
Vicent Marti
c68044a879 Merge pull request #3656 from ethomson/exists_prefixes
Introduce `git_odb_expand_ids`
2016-03-08 21:17:38 +01:00
Edward Thomson
62484f52d1 git_odb_expand_ids: accept git_odb_expand_id array
Take (and write to) an array of a struct, `git_odb_expand_id`.
2016-03-08 14:57:20 -05:00
Edward Thomson
4b1f0f79ac git_odb_expand_ids: rename func, return the type 2016-03-08 11:44:21 -05:00
Edward Thomson
b7809b8469 Merge pull request #3555 from cbargren/ssh-git-protocols
Support for ssh+git and git+ssh protocols
2016-03-08 13:38:55 +00:00
Edward Thomson
534ca8882d Merge pull request #3652 from libgit2/cmn/commit-to-memory
commit: split creating the commit and writing it out
2016-03-08 13:35:11 +00:00
Carlos Martín Nieto
47cb42da5a commit: split creating the commit and writing it out
Sometimes you want to create a commit but not write it out to the
objectdb immediately. For these cases, provide a new function to
retrieve the buffer instead of having to go through the db.
2016-03-08 13:11:49 +01:00
Carlos Martín Nieto
eeff96c474 Merge pull request #3655 from ethomson/nanosecond_defaults
Enable nanosecond resolution by default
2016-03-08 10:43:33 +01:00
Edward Thomson
53fb823bcc index::racy: force racy entry
Instead of hoping that we can get a racy entry by going real fast
and praying real hard, just create a racy entry.
2016-03-08 00:47:55 -05:00
Edward Thomson
eee1799746 Merge pull request #3658 from patrickmckenna/update-pro-git-link
Update link to Pro Git's Git internals chapter
2016-03-08 01:45:29 +00:00
Patrick McKenna
698e0c2777 Update link to Pro Git's Git internals chapter. 2016-03-07 16:34:30 -08:00
Edward Thomson
565c419972 index::nsec: don't expect shit filesystems to not suck
If the underlying filesystem doesn't support better than one
second resolution, then don't expect that turning on `GIT_USE_NSEC`
does anything magical to change that.
2016-03-07 17:04:32 -05:00
Edward Thomson
6c04269c8f git_odb_exists_many_prefixes: query odb for multiple short ids
Query the object database for multiple objects at a time, given their
object ID (which may be abbreviated) and optional type.
2016-03-07 16:10:25 -05:00
Edward Thomson
e10144ae57 odb: improved not found error messages
When looking up an abbreviated oid, show the actual (abbreviated) oid
the caller passed instead of a full (but ambiguously truncated) oid.
2016-03-07 10:20:01 -05:00
Edward Thomson
6abdf52d6e merge::workdir::dirty: update to use st_ctime_nsec
Update unit test to use newfangled `st_ctime_nsec`, which provides
indirection to the platform-correct name.
2016-03-07 09:37:51 -05:00
Edward Thomson
785d8c48ea Merge pull request #3653 from libgit2/cmn/treebuilder-submodule
treebuilder: don't try to verify submodules exist in the odb
2016-03-04 13:50:23 +00:00
Carlos Martín Nieto
ea5bf6bbce treebuilder: don't try to verify submodules exist in the odb
Submodules don't exist in the objectdb and the code is making us try to
look for a blob with its commit id, which is obviously not going to
work.

Skip the test if the user wants to insert a submodule.
2016-03-04 12:38:28 +01:00
Edward Thomson
1609983377 Merge pull request #3651 from libgit2/cmn/init-libssh2
ssh: initialize libssh2
2016-03-03 22:57:45 +00:00
Carlos Martín Nieto
22f3d3aa6b ssh: initialize libssh2
We should have been doing this, but it initializes itself upon first
use, which works as long as nobody's doing concurrent network
operations. Initialize it on our init to make sure it's not getting
initialized concurrently.
2016-03-03 22:26:31 +01:00
Carlos Martín Nieto
839bdb05a0 Merge pull request #3639 from srajko/threading-openssl-libssh2
Expand OpenSSL and libssh2 thread safety documentation
2016-03-03 21:20:33 +01:00
Edward Thomson
2d8807126b Enable nanosecond resolution by default
Nanosecond resolution is now the default in git itself.  Enable this
as our default as well.
2016-03-03 15:08:12 -05:00
Carlos Martín Nieto
e23efa6ddf tests: take the version from our define 2016-03-03 21:03:10 +01:00
Carlos Martín Nieto
1e8255a39b Bump version to 0.24.0 2016-03-03 20:20:43 +01:00
Carlos Martín Nieto
c21c8f67e8 CHANGELOG: prepre tamplate for release 2016-03-03 20:18:55 +01:00
Carlos Martín Nieto
a7ef27af1c CHANGELOG: add note about WinHTTP cred handling 2016-03-03 20:17:13 +01:00
Carlos Martín Nieto
66a530eb4e Merge pull request #3648 from libgit2/cmn/auth-retry
test: make sure we retry the auth callback on all platforms
2016-03-03 20:11:18 +01:00
Carlos Martín Nieto
ba9bb664f3 tests: create a ctest target for cred_callback 2016-03-03 19:31:02 +01:00
Carlos Martín Nieto
778fb695ed Merge pull request #3646 from pks-t/pks/xdiff-fix-from-upstream
xdiff: fix memleak on error case
2016-03-03 12:14:02 +01:00
Carlos Martín Nieto
a4cba9d453 winhttp: retry authentication
If the caller has provided bad authentication, give them another
apportunity to get it right until they give up. This brings WinHTTP in
line with the other transports.
2016-03-03 11:18:03 +01:00
Carlos Martín Nieto
2520573778 test: make sure we retry the auth callback on all platforms
We were missing this test on Windows, which meant we didn't notice that
we never fixed the single authentication attempt it tries, nor its wrong
return code.

Enable this for the unix platforms as well over HTTP. We previously were
doing it locally but disabled it on OS X due to issues with its sshd not
accepting password authentication.
2016-03-03 11:18:03 +01:00
Carlos Martín Nieto
9b3fc895b7 tests: plug a leak 2016-03-03 11:17:36 +01:00
Edward Thomson
edaffe22a2 Merge pull request #3633 from ethomson/safe_creation
Stricter object dependency checking during creation
2016-03-01 17:16:27 +00:00
Patrick Steinhardt
a4ea7faaad xdiff: fix memleak on error case
Commit 3d1abc5afc fixes a memory leak in the xdiff code. In the
process of upstreaming the fix it was pointed out by Johannes
Schindelin that there is another memory leak present (see [1]).

Fix the second memory leak by applying the upstream fix to our
code base.

[1]: http://thread.gmane.org/gmane.comp.version-control.git/287034
2016-03-01 08:56:23 +01:00
Edward Thomson
dbee683553 Merge pull request #3567 from sba1/few-p_getaddrinfo-fixes
Few p_getaddrinfo fixes
2016-02-28 20:13:24 -05:00