Commit Graph

9621 Commits

Author SHA1 Message Date
Carlos Martín Nieto
40b08124f2 Merge pull request #3915 from pks-t/pks/index-collision-test-leak
tests: index: do not re-allocate index
2016-08-30 12:11:02 +02:00
Patrick Steinhardt
a08e88259f Merge pull request #3907 from steffhip/git_checkout_tree-fix 2016-08-30 08:22:49 +02:00
Stefan Huber
88cfe61497 git_checkout_tree options fix
According to the reference the git_checkout_tree and git_checkout_head
functions should accept NULL in the opts field

This was broken since the opts field was dereferenced and thus lead to a
crash.
2016-08-30 08:04:28 +02:00
Edward Thomson
dfd7957696 Merge pull request #3914 from pks-t/pks/libqgit2-binding-url
README: adjust URL to libqgit2 repository
2016-08-29 09:39:03 -05:00
Patrick Steinhardt
86e88534d6 tests: index: do not re-allocate index
Plug a memory leak caused by re-allocating a `git_index`
structure which has already been allocated by the test suite's
initializer.
2016-08-29 13:29:01 +02:00
Patrick Steinhardt
8044ee42f5 README: adjust URL to libqgit2 repository 2016-08-29 09:38:20 +02:00
Patrick Steinhardt
ace0d36be9 Merge pull request #3900 from pks-t/pks/http-close-substream-on-connect
transports: http: set substream as disconnected after closing
2016-08-29 09:29:34 +02:00
Edward Thomson
5671e81fdd Merge pull request #3908 from libgit2/ethomson/patch_from_diff
Teach `git_patch_from_diff` about parsed diffs
2016-08-26 10:09:12 -05:00
Edward Thomson
b859faa61c Teach git_patch_from_diff about parsed diffs
Ensure that `git_patch_from_diff` can return the patch for parsed diffs,
not just generate a patch for a generated diff.
2016-08-24 09:08:57 -05:00
Patrick Steinhardt
c60210d367 Merge pull request #3904 from stinb/filesystem-iterator-double-free
filesystem_iterator: fixed double free on error
2016-08-24 08:28:49 +02:00
Jason Haslam
7a3f1de500 filesystem_iterator: fixed double free on error 2016-08-22 09:27:47 -06:00
Edward Thomson
c1b370e931 Merge pull request #3837 from novalis/dturner/indexv4
Support index v4
2016-08-17 09:24:44 -05:00
Edward Thomson
635a922274 Merge pull request #3895 from pks-t/pks/negate-basename-in-subdirs
ignore: allow unignoring basenames in subdirectories
2016-08-17 08:54:48 -05:00
Patrick Steinhardt
b1453601f9 transports: http: reset connected flag when closing transport 2016-08-17 11:41:30 +02:00
Patrick Steinhardt
c4cba4e96a transports: http: reset connected flag when re-connecting transport
When calling `http_connect` on a subtransport whose stream is already
connected, we first close the stream in case no keep-alive is in use.
When doing so, we do not reset the transport's connection state,
though. Usually, this will do no harm in case the subsequent connect
will succeed. But when the connection fails we are left with a
substransport which is tagged as connected but which has no valid
stream attached.

Fix the issue by resetting the subtransport's connected-state when
closing its stream in `http_connect`.
2016-08-17 11:41:22 +02:00
Patrick Steinhardt
fcb2c1c895 ignore: allow unignoring basenames in subdirectories
The .gitignore file allows for patterns which unignore previous
ignore patterns. When unignoring a previous pattern, there are
basically three cases how this is matched when no globbing is
used:

1. when a previous file has been ignored, it can be unignored by
   using its exact name, e.g.

   foo/bar
   !foo/bar

2. when a file in a subdirectory has been ignored, it can be
   unignored by using its basename, e.g.

   foo/bar
   !bar

3. when all files with a basename are ignored, a specific file
   can be unignored again by specifying its path in a
   subdirectory, e.g.

   bar
   !foo/bar

The first problem in libgit2 is that we did not correctly treat
the second case. While we verified that the negative pattern
matches the tail of the positive one, we did not verify if it
only matches the basename of the positive pattern. So e.g. we
would have also negated a pattern like

    foo/fruz_bar
    !bar

Furthermore, we did not check for the third case, where a
basename is being unignored in a certain subdirectory again.

Both issues are fixed with this commit.
2016-08-12 14:47:54 +02:00
David Turner
5625d86b99 index: support index v4
Support reading and writing index v4.  Index v4 uses a very simple
compression scheme for pathnames, but is otherwise similar to index v3.

Signed-off-by: David Turner <dturner@twitter.com>
2016-08-10 14:19:30 -04:00
David Turner
aeb5ee5ab5 varint: Add varint encoding/decoding
This code is ported from git.git

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Turner <dturner@twopensource.com>
2016-08-10 14:19:06 -04:00
Carlos Martín Nieto
26a8617d96 Merge pull request #3891 from pks-t/pks/stransport-memory-management-improvements
stransport memory management improvements
2016-08-09 14:34:55 +02:00
Edward Thomson
5961face15 Merge pull request #3893 from pks-t/pks/remove-unused-test-cb
tests: blob: remove unused callback function
2016-08-09 08:07:10 -04:00
Patrick Steinhardt
4006455f01 tests: blob: remove unused callback function 2016-08-09 10:09:23 +02:00
Patrick Steinhardt
b989514405 stransport: do not use git_stream_free on uninitialized stransport
When failing to initialize a new stransport stream, we try to
release already allocated memory by calling out to
`git_stream_free`, which in turn called out to the stream's
`free` function pointer. As we only initialize the function
pointer later on, this leads to a `NULL` pointer exception.

Furthermore, plug another memory leak when failing to create the
SSL context.
2016-08-09 08:38:54 +02:00
Carlos Martín Nieto
97e57e8770 Merge pull request #3887 from libgit2/ethomson/empty_blob
odb: only provide the empty tree
2016-08-08 15:13:59 +02:00
Edward Thomson
b47e79e2cd Merge pull request #3890 from pks-t/pks/stransport-static-linkage
stransport: make internal functions static
2016-08-08 08:42:32 -04:00
Patrick Steinhardt
067bf5dcc5 stransport: make internal functions static 2016-08-08 13:49:17 +02:00
Carlos Martín Nieto
0fd5a44dde Merge pull request #3888 from libgit2/ethomson/doc_diff_from_buffer
diff: document `git_diff_from_buffer`
2016-08-08 13:12:51 +02:00
Edward Thomson
9bc8c80ffa odb: actually insert the empty blob in tests 2016-08-05 20:34:19 -04:00
Edward Thomson
e2e7f31ad0 diff: document git_diff_from_buffer 2016-08-05 20:01:52 -04:00
Edward Thomson
becadafca8 odb: only provide the empty tree
Only provide the empty tree internally, which matches git's behavior.
If we provide the empty blob then any users trying to write it with
libgit2 would omit it from actually landing in the odb, which appear
to git proper as a broken repository (missing that object).
2016-08-05 19:30:56 -04:00
Edward Thomson
56bbdf9349 Merge pull request #3886 from libgit2/cmn/copypeertrust-null
SecureTransport: handle NULL trust on success
2016-08-05 14:23:29 -04:00
Carlos Martín Nieto
9884dd613e SecureTransport: handle NULL trust on success
The `SSLCopyPeerTrust` call can succeed but fail to return a trust
object if it can't load the certificate chain and thus cannot check the
validity of a certificate. This can lead to us calling `CFRelease` on a
`NULL` trust object, causing a crash.

Handle this by returning ECERTIFICATE.
2016-08-05 18:40:37 +02:00
Carlos Martín Nieto
c550c92228 Merge pull request #3881 from pks-t/pks/fix-clar-suite-prefix-computation
clar: fix parsing of test suite prefixes
2016-08-05 18:24:28 +02:00
Edward Thomson
cba60b9b0e Merge pull request #3884 from pks-t/pks/patch-image-initialization
Patch image initialization
2016-08-05 09:10:58 -04:00
Patrick Steinhardt
274a727e0b apply: fix warning when initializing patch images 2016-08-05 10:57:42 +02:00
Patrick Steinhardt
844f5b2062 pool: provide macro to statically initialize git_pool 2016-08-05 10:57:13 +02:00
Edward Thomson
73dab7692e Merge pull request #3861 from libgit2/ethomson/refresh_objects
odb: freshen existing objects when writing
2016-08-04 16:16:16 -04:00
Edward Thomson
27051d4e31 odb: only freshen pack files every 2 seconds
Since writing multiple objects may all already exist in a single
packfile, avoid freshening that packfile repeatedly in a tight loop.
Instead, only freshen pack files every 2 seconds.
2016-08-04 15:12:04 -04:00
Edward Thomson
8f09a98e18 odb: freshen existing objects when writing
When writing an object, we calculate its OID and see if it exists in the
object database.  If it does, we need to freshen the file that contains
it.
2016-08-04 15:12:04 -04:00
Carlos Martín Nieto
d2794b0e37 Merge pull request #3877 from libgit2/ethomson/paths_init
sysdir: don't assume an empty dir is uninitialized
2016-08-04 20:49:50 +02:00
Edward Thomson
0d84de0208 Merge pull request #3869 from richardipsum/fix-outdated-comment
Fix outdated comment
2016-08-04 13:20:49 -04:00
Edward Thomson
78b500bf59 Merge pull request #3850 from wildart/custom-tls
Enable https transport for custom TLS streams
2016-08-04 12:45:19 -04:00
Edward Thomson
031d34b7e8 sysdir: use the standard init pattern
Don't try to determine when sysdirs are uninitialized.  Instead, simply
initialize them all at `git_libgit2_init` time and never try to
reinitialize, except when consumers explicitly call `git_sysdir_set`.

Looking at the buffer length is especially problematic, since there may
no appropriate path for that value.  (For example, the Windows-specific
programdata directory has no value on non-Windows machines.)

Previously we would continually trying to re-lookup these values,
which could get racy if two different threads are each calling
`git_sysdir_get` and trying to lookup / clear the value simultaneously.
2016-08-04 12:26:06 -04:00
Edward Thomson
da7f9feb5c Merge pull request #3879 from libgit2/ethomson/mwindow_init
mwindow: init mwindow files in git_libgit2_init
2016-08-04 11:51:06 -04:00
Edward Thomson
2381d9e490 mwindow: init mwindow files in git_libgit2_init 2016-08-04 10:30:48 -04:00
Patrick Steinhardt
f2cab0a6fa clar: fix parsing of test suite prefixes
When passing in a specific suite which should be executed by clar
via `-stest::suite`, we try to parse this string and then include
all tests contained in this suite. This also includes all tests
in sub-suites, e.g. 'test::suite::foo'.

In the case where multiple suites start with the same _string_,
for example 'test::foo' and 'test::foobar', we fail to
distinguish this correctly. When passing in `-stest::foobar`,
we wrongly determine that 'test::foo' is a prefix and try to
execute all of its matching functions. But as no function
will now match 'test::foobar', we simply execute nothing.

To fix this, we instead have to check if the prefix is an actual
suite prefix as opposed to a simple string prefix. We do so by by
inspecting if the first two characters trailing the prefix are
our suite delimiters '::', and only consider the filter as
matching in this case.
2016-08-04 11:49:39 +02:00
Edward Thomson
baa87dfc50 Merge pull request #3880 from libgit2/ethomson/diff_file
git_diff_file: move `id_abbrev`
2016-08-03 22:00:21 -04:00
Edward Thomson
002c8e29a1 git_diff_file: move id_abbrev
Move `id_abbrev` to a more reasonable place where it packs more nicely
(before anybody starts using it).
2016-08-03 17:57:37 -04:00
Edward Thomson
152efee20b Merge pull request #3865 from libgit2/ethomson/leaks
Fix leaks, some warnings and an error
2016-08-02 18:43:12 -04:00
Edward Thomson
df87648ab8 crlf: set a safe crlf default 2016-07-24 16:10:30 -04:00
Edward Thomson
a37624ecc7 Merge pull request #3815 from pks-t/pks/coverity-model
Coverity user model
2016-07-24 16:05:17 -04:00