]> git.proxmox.com Git - libgit2.git/log
libgit2.git
7 years agoMerge pull request #4076 from libgit2/cmn/sec-update-25
Carlos Martín Nieto [Mon, 9 Jan 2017 20:26:45 +0000 (20:26 +0000)]
Merge pull request #4076 from libgit2/cmn/sec-update-25

security updates for v0.25

7 years agohttps: don't test that RC4 is invalid
Carlos Martín Nieto [Mon, 9 Jan 2017 17:53:21 +0000 (17:53 +0000)]
https: don't test that RC4 is invalid

None of our crypto backends actually reject RC4 as a cipher so don't
test for it and instead keep it as something we'd like to do.

7 years agohttp: correct the expected error for RC4
Carlos Martín Nieto [Mon, 9 Jan 2017 17:50:17 +0000 (17:50 +0000)]
http: correct the expected error for RC4

We must make sure that we're getting a certificate error from the
library so we know that we're testing the right thing.

7 years agoBump version to 0.25.1
Edward Thomson [Fri, 6 Jan 2017 17:15:53 +0000 (17:15 +0000)]
Bump version to 0.25.1

7 years agoMerge branch '25_smartpktparse' into maint/v0.25
Edward Thomson [Fri, 6 Jan 2017 17:12:16 +0000 (17:12 +0000)]
Merge branch '25_smartpktparse' into maint/v0.25

7 years agosmart_pkt: treat empty packet lines as error
Patrick Steinhardt [Tue, 15 Nov 2016 10:44:51 +0000 (11:44 +0100)]
smart_pkt: treat empty packet lines as error

The Git protocol does not specify what should happen in the case
of an empty packet line (that is a packet line "0004"). We
currently indicate success, but do not return a packet in the
case where we hit an empty line. The smart protocol was not
prepared to handle such packets in all cases, though, resulting
in a `NULL` pointer dereference.

Fix the issue by returning an error instead. As such kind of
packets is not even specified by upstream, this is the right
thing to do.

7 years agosmart_pkt: verify packet length exceeds PKT_LEN_SIZE
Patrick Steinhardt [Tue, 15 Nov 2016 10:36:27 +0000 (11:36 +0100)]
smart_pkt: verify packet length exceeds PKT_LEN_SIZE

Each packet line in the Git protocol is prefixed by a four-byte
length of how much data will follow, which we parse in
`git_pkt_parse_line`. The transmitted length can either be equal
to zero in case of a flush packet or has to be at least of length
four, as it also includes the encoded length itself. Not
checking this may result in a buffer overflow as we directly pass
the length to functions which accept a `size_t` length as
parameter.

Fix the issue by verifying that non-flush packets have at least a
length of `PKT_LEN_SIZE`.

7 years agoMerge branch '25_certcheckcb' into maint/v0.25
Edward Thomson [Fri, 6 Jan 2017 17:10:49 +0000 (17:10 +0000)]
Merge branch '25_certcheckcb' into maint/v0.25

7 years agohttp: perform 'badssl' check also via certificate callback
Carlos Martín Nieto [Fri, 6 Jan 2017 10:51:31 +0000 (10:51 +0000)]
http: perform 'badssl' check also via certificate callback

Make sure that the callbacks do also get a 'valid' value of zero when
the certificate we're looking at is in valid and assert that within the
test.

7 years agohttp: check certificate validity before clobbering the error variable
Etienne Samson [Wed, 21 Dec 2016 20:24:33 +0000 (21:24 +0100)]
http: check certificate validity before clobbering the error variable

7 years agoMerge pull request #3980 from tiennou/doc-fixes
Carlos Martín Nieto [Tue, 20 Dec 2016 19:14:20 +0000 (19:14 +0000)]
Merge pull request #3980 from tiennou/doc-fixes

Documentation fixes

7 years agoMerge pull request #4041 from libgit2/cmn/bump-pretend-git
Edward Thomson [Tue, 20 Dec 2016 17:17:12 +0000 (17:17 +0000)]
Merge pull request #4041 from libgit2/cmn/bump-pretend-git

http: bump the pretend git version in the User-Agent

7 years agohttp: bump the pretend git version in the User-Agent
Carlos Martín Nieto [Tue, 20 Dec 2016 16:19:30 +0000 (16:19 +0000)]
http: bump the pretend git version in the User-Agent

We want to keep the git UA in order for services to recognise that we're
a Git client and not a browser. But in order to stop dumb HTTP some
services have blocked UAs that claim to be pre-1.6.6 git.

Thread these needles by using the "git/2.0" prefix which is still close
enough to git's yet distinct enough that you can tell it's us.

7 years agoMerge pull request #4034 from libgit2/cmn/sysdir-no-reguess
Edward Thomson [Tue, 20 Dec 2016 15:32:49 +0000 (15:32 +0000)]
Merge pull request #4034 from libgit2/cmn/sysdir-no-reguess

sysdir: don't re-guess when using variable substitution

7 years agoMerge pull request #4032 from libgit2/cmn/https-cap-no-hardcode
Edward Thomson [Tue, 20 Dec 2016 15:28:46 +0000 (15:28 +0000)]
Merge pull request #4032 from libgit2/cmn/https-cap-no-hardcode

Don't hard-code HTTPS cap & clarify the meanings of the features enum

7 years agoMerge pull request #4037 from libgit2/cmn/goals
Carlos Martín Nieto [Tue, 20 Dec 2016 12:14:22 +0000 (12:14 +0000)]
Merge pull request #4037 from libgit2/cmn/goals

README: be more explicit in the goals and scope

7 years agoMerge pull request #4038 from lucasderraugh/patch-1
Carlos Martín Nieto [Mon, 19 Dec 2016 18:04:20 +0000 (18:04 +0000)]
Merge pull request #4038 from lucasderraugh/patch-1

Gift deprecated in favor of SwiftGit2

7 years agoMerge pull request #4026 from libgit2/cmn/refdb-fs-errors
Carlos Martín Nieto [Mon, 19 Dec 2016 17:28:41 +0000 (17:28 +0000)]
Merge pull request #4026 from libgit2/cmn/refdb-fs-errors

refdb: bubble up recursive rm when locking a ref

7 years agoMerge pull request #4027 from pks-t/pks/pack-deref-cache-on-error
Carlos Martín Nieto [Mon, 19 Dec 2016 17:26:09 +0000 (17:26 +0000)]
Merge pull request #4027 from pks-t/pks/pack-deref-cache-on-error

pack: dereference cached pack entry on error

7 years agoGift deprecated in favor of SwiftGit2
Lucas Derraugh [Mon, 19 Dec 2016 17:09:34 +0000 (09:09 -0800)]
Gift deprecated in favor of SwiftGit2

7 years agoMerge pull request #4033 from andhe/master
Carlos Martín Nieto [Mon, 19 Dec 2016 16:25:01 +0000 (16:25 +0000)]
Merge pull request #4033 from andhe/master

Fix off-by-one problems in git_signature__parse

7 years agoREADME: be more explicit in the goals and scope
Carlos Martín Nieto [Mon, 19 Dec 2016 13:54:55 +0000 (13:54 +0000)]
README: be more explicit in the goals and scope

Make it clearer from the get-go that we do not aim to implement
user-facing commands from the git tool.

7 years agosysdir: don't guess the paths again when $PATH is specified
Carlos Martín Nieto [Sat, 17 Dec 2016 18:20:29 +0000 (18:20 +0000)]
sysdir: don't guess the paths again when $PATH is specified

We should replace it with whatever the user set, not start again.

7 years agosysdir: add failing test for variable substitution
Carlos Martín Nieto [Sat, 17 Dec 2016 18:18:30 +0000 (18:18 +0000)]
sysdir: add failing test for variable substitution

When given $PATH as part of a search path, we guess again instead of
substituting what the user already set.

7 years agoFix off-by-one problems in git_signature__parse
Andreas Henriksson [Sat, 17 Dec 2016 16:33:13 +0000 (17:33 +0100)]
Fix off-by-one problems in git_signature__parse

Etc/GMT-14 aka UTC+14:00 is a thing....
https://en.wikipedia.org/wiki/UTC%2B14:00

Also allow offsets on the last minute (59).

Addresses: https://bugs.debian.org/841532
Fixes: #3970
7 years agosettings: clarify what each value means
Carlos Martín Nieto [Sat, 17 Dec 2016 14:31:36 +0000 (14:31 +0000)]
settings: clarify what each value means

Most importantly, clarify what it means for HTTPS and SSH to be supported.

7 years agosettings: don't hard-code HTTPS capability
Carlos Martín Nieto [Sat, 17 Dec 2016 14:23:35 +0000 (14:23 +0000)]
settings: don't hard-code HTTPS capability

This partially reverts bdec62dce1c17465b7330100ea2f71e63fc411dd which activates
the transport code-paths which allow you to use a custom TLS implementation
without having to have one at build-time.

However the capabilities describe how libgit2 was built, not what it could
potentially support, bring back the ifdefs so we only say we support HTTPS if
libgit2 was itself built with a TLS implementation.

7 years agoMerge pull request #4031 from libgit2/cmn/plug-test-leak
Carlos Martín Nieto [Sat, 17 Dec 2016 01:12:49 +0000 (01:12 +0000)]
Merge pull request #4031 from libgit2/cmn/plug-test-leak

rebase: plug a leak in the tests

7 years agorebase: plug a leak in the tests
Carlos Martín Nieto [Sat, 17 Dec 2016 00:55:06 +0000 (00:55 +0000)]
rebase: plug a leak in the tests

7 years agorefdb: bubble up recursive rm when locking a ref
Carlos Martín Nieto [Sun, 11 Dec 2016 17:56:38 +0000 (17:56 +0000)]
refdb: bubble up recursive rm when locking a ref

Failure to bubble up this error means some locking errors do not get reported as
such on Windows.

7 years agoMerge pull request #4029 from libgit2/cmn/windows-no-concurrent-compress
Edward Thomson [Fri, 16 Dec 2016 00:19:49 +0000 (18:19 -0600)]
Merge pull request #4029 from libgit2/cmn/windows-no-concurrent-compress

refdb: disable concurrent compress in the threading tests on Windows

7 years agoMerge pull request #4018 from pks-t/pks/various-fixes
Carlos Martín Nieto [Mon, 12 Dec 2016 22:43:11 +0000 (22:43 +0000)]
Merge pull request #4018 from pks-t/pks/various-fixes

Various fixes

7 years agorefdb: disable concurrent compress in the threading tests on Windows
Carlos Martín Nieto [Mon, 12 Dec 2016 17:09:12 +0000 (17:09 +0000)]
refdb: disable concurrent compress in the threading tests on Windows

This is far from an ideal situation, but this causes issues on Windows which
make it harder to develop anything, as these tests hit issues which relate
specifically to the Windows filesystem like permission errors for files we
should be able to access. There is an issue likely related to the ordering of
the repack, but there's enough noise that it does not currently help us to run
this aspect of the test in CI.

7 years agopack: dereference cached pack entry on error
Patrick Steinhardt [Mon, 12 Dec 2016 08:36:15 +0000 (09:36 +0100)]
pack: dereference cached pack entry on error

When trying to uncompress deltas in a packfile's delta chain, we try to
add object bases to the packfile cache, subsequently decrementing its
reference count if it has been added successfully. This may lead to a
mismatched reference count in the case where we exit the loop early due
to an encountered error.

Fix the issue by decrementing the reference count in error cleanup.

7 years agoFix potential use of uninitialized values
Patrick Steinhardt [Fri, 25 Nov 2016 14:02:34 +0000 (15:02 +0100)]
Fix potential use of uninitialized values

7 years agograph: flag fields should be declared as unsigned
Patrick Steinhardt [Fri, 25 Nov 2016 14:02:07 +0000 (15:02 +0100)]
graph: flag fields should be declared as unsigned

7 years agotransports: smart: do not redeclare loop counters
Patrick Steinhardt [Fri, 25 Nov 2016 14:01:35 +0000 (15:01 +0100)]
transports: smart: do not redeclare loop counters

7 years agopath: remove unused local variable
Patrick Steinhardt [Fri, 25 Nov 2016 14:01:04 +0000 (15:01 +0100)]
path: remove unused local variable

7 years agorevwalk: do not re-declare `commit` variable
Patrick Steinhardt [Fri, 25 Nov 2016 14:00:50 +0000 (15:00 +0100)]
revwalk: do not re-declare `commit` variable

7 years agoodb_mempack: mark zero-length array as GIT_FLEX_ARRAY
Patrick Steinhardt [Fri, 25 Nov 2016 14:00:20 +0000 (15:00 +0100)]
odb_mempack: mark zero-length array as GIT_FLEX_ARRAY

7 years agoclar: mark `cl_git_thread_check()` as inline
Patrick Steinhardt [Fri, 25 Nov 2016 13:58:16 +0000 (14:58 +0100)]
clar: mark `cl_git_thread_check()` as inline

The function `cl_git_thread_check()` is defined as static. As the
function is defined in a header file which is included by our
tests, this can result in warnings for every test file where
`cl_git_thread_check` is never used.

Fix the issue by marking it as inline instead.

7 years agoMerge pull request #4020 from novalis/rebase-detached
Edward Thomson [Wed, 7 Dec 2016 17:44:25 +0000 (17:44 +0000)]
Merge pull request #4020 from novalis/rebase-detached

git_rebase_init: correctly handle detached HEAD

7 years agoMerge pull request #4014 from bokic/patch-1
Edward Thomson [Wed, 7 Dec 2016 15:01:20 +0000 (15:01 +0000)]
Merge pull request #4014 from bokic/patch-1

Properly pass `wchar *` type to giterr_set

7 years agoProperly pass `wchar *` type to giterr_set
Boris Barbulovski [Tue, 6 Dec 2016 02:08:52 +0000 (03:08 +0100)]
Properly pass `wchar *` type to giterr_set

7 years agoMerge pull request #4022 from josharian/patch-1
Edward Thomson [Sun, 4 Dec 2016 15:58:40 +0000 (15:58 +0000)]
Merge pull request #4022 from josharian/patch-1

remote: fix typo in git_fetch_init_options docs

7 years agoremote: fix typo in git_fetch_init_options docs
Josh Bleecher Snyder [Sat, 3 Dec 2016 00:14:47 +0000 (16:14 -0800)]
remote: fix typo in git_fetch_init_options docs

7 years agogit_rebase_init: correctly handle detached HEAD
David Turner [Fri, 2 Dec 2016 04:06:41 +0000 (23:06 -0500)]
git_rebase_init: correctly handle detached HEAD

git_rebase_finish relies on head_detached being set, but
rebase_init_merge was only setting it when branch->ref_name was unset.
But branch->ref_name would be set to "HEAD" in the case of detached
HEAD being either implicitly (NULL) or explicitly passed to
git_rebase_init.

8 years agoProperly pass `wchar *` type to giterr_set
Boris Barbulovski [Sun, 20 Nov 2016 10:30:45 +0000 (11:30 +0100)]
Properly pass `wchar *` type to giterr_set

8 years agoMerge pull request #4010 from libgit2/ethomson/clar_threads
Carlos Martín Nieto [Fri, 18 Nov 2016 20:01:51 +0000 (21:01 +0100)]
Merge pull request #4010 from libgit2/ethomson/clar_threads

Introduce some clar helpers for child threads

8 years agotests: handle life without threads
Edward Thomson [Fri, 18 Nov 2016 18:30:20 +0000 (18:30 +0000)]
tests: handle life without threads

8 years agothreads::refdb tests: use new threaded clar assert
Edward Thomson [Fri, 18 Nov 2016 12:37:47 +0000 (07:37 -0500)]
threads::refdb tests: use new threaded clar assert

8 years agoclar: Introduce assertion helpers for threads
Edward Thomson [Fri, 18 Nov 2016 12:34:20 +0000 (07:34 -0500)]
clar: Introduce assertion helpers for threads

Don't `cl_git_pass` in a child thread.  When the assertion fails, clar
will `longjmp` to its error handler, but:

> The effect of a call to longjmp() where initialization of the jmp_buf
> structure was not performed in the calling thread is undefined.

Instead, set up an error context that threads can populate, and the
caller can check.

8 years agocore::init tests: reverse init/shutdown
Edward Thomson [Fri, 18 Nov 2016 16:50:34 +0000 (16:50 +0000)]
core::init tests: reverse init/shutdown

We want a predictable number of initializations in our multithreaded
init test, but we also want to make sure that we have _actually_
initialized `git_libgit2_init` before calling `git_thread_create` (since
it now has a sanity check that `git_libgit2_init` has been called).

Since `git_thread_create` is internal-only, keep this sanity check.
Flip the invocation so that we `git_libgit2_init` before our thread
tests and `git_libgit2_shutdown` again after.

8 years agothreads: introduce `git_thread_exit`
Edward Thomson [Fri, 18 Nov 2016 12:19:22 +0000 (07:19 -0500)]
threads: introduce `git_thread_exit`

Introduce `git_thread_exit`, which will allow threads to terminate at an
arbitrary time, returning a `void *`.  On Windows, this means that we
need to store the current `git_thread` in TLS, so that we can set its
`return` value when terminating.

We cannot simply use `ExitThread`, since Win32 returns `DWORD`s from
threads; we return `void *`.

8 years agoMerge pull request #4009 from pranitbauva1997/fix-string-format
Carlos Martín Nieto [Thu, 17 Nov 2016 14:45:23 +0000 (15:45 +0100)]
Merge pull request #4009 from pranitbauva1997/fix-string-format

use `giterr_set_str()` wherever possible

8 years agouse `giterr_set_str()` wherever possible
Pranit Bauva [Wed, 16 Nov 2016 19:38:49 +0000 (01:08 +0530)]
use `giterr_set_str()` wherever possible

`giterr_set()` is used when it is required to format a string, and since
we don't really require it for this case, it is better to stick to
`giterr_set_str()`.

This also suppresses a warning(-Wformat-security) raised by the compiler.

Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
8 years agoMerge pull request #4007 from libgit2/cmn/bump-v25
Carlos Martín Nieto [Tue, 15 Nov 2016 18:04:18 +0000 (19:04 +0100)]
Merge pull request #4007 from libgit2/cmn/bump-v25

Bump version number to v0.25

8 years agoMerge pull request #4008 from pks-t/pks/sortedcache-fd-leak
Carlos Martín Nieto [Tue, 15 Nov 2016 15:28:10 +0000 (16:28 +0100)]
Merge pull request #4008 from pks-t/pks/sortedcache-fd-leak

sortedcache: plug leaked file descriptor

8 years agopatch_parse: fix memory leak
Patrick Steinhardt [Tue, 15 Nov 2016 12:33:05 +0000 (13:33 +0100)]
patch_parse: fix memory leak

8 years agosortedcache: plug leaked file descriptor
Patrick Steinhardt [Tue, 15 Nov 2016 11:53:53 +0000 (12:53 +0100)]
sortedcache: plug leaked file descriptor

8 years agoMerge pull request #3996 from pks-t/pks/curl-lastsocket-deprecation
Carlos Martín Nieto [Tue, 15 Nov 2016 11:18:49 +0000 (12:18 +0100)]
Merge pull request #3996 from pks-t/pks/curl-lastsocket-deprecation

curl_stream: use CURLINFO_ACTIVESOCKET if curl is recent enough

8 years agoBump version number to v0.25
Carlos Martín Nieto [Tue, 15 Nov 2016 10:15:40 +0000 (11:15 +0100)]
Bump version number to v0.25

8 years agoMerge pull request #3962 from libgit2/ethomson/issue_template
Carlos Martín Nieto [Tue, 15 Nov 2016 10:02:30 +0000 (11:02 +0100)]
Merge pull request #3962 from libgit2/ethomson/issue_template

Introduce a GitHub Issue Template

8 years agoMerge pull request #4004 from libgit2/cmn/changelog
Carlos Martín Nieto [Tue, 15 Nov 2016 09:54:15 +0000 (10:54 +0100)]
Merge pull request #4004 from libgit2/cmn/changelog

CHANGELOG: fill in some updates we missed

8 years agocurl_stream: use CURLINFO_ACTIVESOCKET if curl is recent enough
Patrick Steinhardt [Fri, 11 Nov 2016 10:37:00 +0000 (11:37 +0100)]
curl_stream: use CURLINFO_ACTIVESOCKET if curl is recent enough

The `CURLINFO_LASTSOCKET` information has been deprecated since
curl version 7.45.0 as it may result in an overflow in the
returned socket on certain systems, most importantly on 64 bit
Windows. Instead, a new call `CURLINFO_ACTIVESOCKET` has been
added which instead returns a `curl_socket_t`, which is always
sufficiently long to store a socket.

As we need to provide backwards compatibility with curl versions
smaller than 7.45.0, alias CURLINFO_ACTIVESOCKET to
CURLINFO_LASTSOCKET on platforms without CURLINFO_ACTIVESOCKET.

8 years agoMerge pull request #4006 from libgit2/cmn/compress-buf-free
Edward Thomson [Mon, 14 Nov 2016 19:21:56 +0000 (19:21 +0000)]
Merge pull request #4006 from libgit2/cmn/compress-buf-free

Plug a leak in the refs compressor

8 years agoIntroduce a GitHub Issue Template
Edward Thomson [Thu, 13 Oct 2016 15:40:43 +0000 (16:40 +0100)]
Introduce a GitHub Issue Template

8 years agoCHANGELOG: fill in some updates we missed
Carlos Martín Nieto [Mon, 14 Nov 2016 13:12:13 +0000 (14:12 +0100)]
CHANGELOG: fill in some updates we missed

8 years agoPlug a leak in the refs compressor
Carlos Martín Nieto [Mon, 14 Nov 2016 16:55:49 +0000 (17:55 +0100)]
Plug a leak in the refs compressor

8 years agoMerge pull request #3998 from pks-t/pks/repo-discovery
Carlos Martín Nieto [Mon, 14 Nov 2016 16:10:43 +0000 (17:10 +0100)]
Merge pull request #3998 from pks-t/pks/repo-discovery

Repository discovery starting from files

8 years agoMerge pull request #4003 from libgit2/cmn/tree-updater-ordering
Edward Thomson [Mon, 14 Nov 2016 12:12:38 +0000 (12:12 +0000)]
Merge pull request #4003 from libgit2/cmn/tree-updater-ordering

Use the sorted input in the tree updater

8 years agoMerge pull request #3561 from libgit2/cmn/refdb-para
Edward Thomson [Mon, 14 Nov 2016 11:52:49 +0000 (11:52 +0000)]
Merge pull request #3561 from libgit2/cmn/refdb-para

Concurrency fixes for the reference db

8 years agotree: look for conflicts in the new tree when updating
Carlos Martín Nieto [Mon, 14 Nov 2016 11:44:52 +0000 (12:44 +0100)]
tree: look for conflicts in the new tree when updating

We look at whether we're trying to replace a blob with a tree during the
update phase, but we fail to look at whether we've just inserted a blob
where we're now trying to insert a tree.

Update the check to look at both places. The test for this was
previously succeeding due to the bu where we did not look at the sorted
output.

8 years agotree: use the sorted update list in our loop
Carlos Martín Nieto [Mon, 14 Nov 2016 11:44:01 +0000 (12:44 +0100)]
tree: use the sorted update list in our loop

The loop is made with the assumption that the inputs are sorted and not
using it leads to bad outputs.

8 years agotree: add a failing test for unsorted input
Carlos Martín Nieto [Mon, 14 Nov 2016 11:22:20 +0000 (12:22 +0100)]
tree: add a failing test for unsorted input

We do not currently use the sorted version of this input in the
function, which means we produce bad results.

8 years agorefdb: use a constant for the number of per-thread creations/deletes
Carlos Martín Nieto [Mon, 14 Nov 2016 10:29:40 +0000 (11:29 +0100)]
refdb: use a constant for the number of per-thread creations/deletes

8 years agorefdb: bubble up locked files on the read side
Carlos Martín Nieto [Thu, 10 Mar 2016 21:01:09 +0000 (22:01 +0100)]
refdb: bubble up locked files on the read side

On Windows we can find locked files even when reading a reference or the
packed-refs file. Bubble up the error in this case as well to allow
callers on Windows to retry more intelligently.

8 years agorefdb: expect threaded test deletes to race
Carlos Martín Nieto [Thu, 10 Mar 2016 11:27:07 +0000 (12:27 +0100)]
refdb: expect threaded test deletes to race

At times we may try to delete a reference which a different thread has
already taken care of.

8 years agorefdb: remove a check-delete race when removing a loose ref
Carlos Martín Nieto [Thu, 10 Mar 2016 11:22:34 +0000 (12:22 +0100)]
refdb: remove a check-delete race when removing a loose ref

It does not help us to check whether the file exists before trying to
unlink it since it might be gone by the time unlink is called.

Instead try to remove it and handle the resulting error if it did not
exist.

8 years agosortedcache: check file size after opening the file
Carlos Martín Nieto [Thu, 31 Dec 2015 14:51:42 +0000 (14:51 +0000)]
sortedcache: check file size after opening the file

Checking the size before we open the file descriptor can lead to the
file being replaced from under us when renames aren't quite atomic, so
we can end up reading too little of the file, leading to us thinking the
file is corrupted.

8 years agorefdb: add retry logic to the threaded tests
Carlos Martín Nieto [Thu, 24 Dec 2015 17:51:19 +0000 (17:51 +0000)]
refdb: add retry logic to the threaded tests

The logic simply consists of retrying for as long as the library says
the data is locked, but it eventually gets through.

8 years agorefdb: bubble up the error code when compressing the db
Carlos Martín Nieto [Thu, 24 Dec 2015 17:49:49 +0000 (17:49 +0000)]
refdb: bubble up the error code when compressing the db

This allows the caller to know the errors was e.g. due to the
packed-refs file being already locked and they can try again later.

8 years agorefdb: refactor the lockfile cleanup
Carlos Martín Nieto [Thu, 24 Dec 2015 17:38:41 +0000 (17:38 +0000)]
refdb: refactor the lockfile cleanup

We can reduce the duplication by cleaning up at the beginning of the
loop, since it's something we want to do every time we continue.

8 years agorefdb: don't report failure for expected errors
Carlos Martín Nieto [Thu, 24 Dec 2015 17:30:24 +0000 (17:30 +0000)]
refdb: don't report failure for expected errors

There might be a few threads or processes working with references
concurrently, so fortify the code to ignore errors which come from
concurrent access which do not stop us from continuing the work.

This includes ignoring an unlinking error. Either someone else removed
it or we leave the file around. In the former case the job is done, and
in the latter case, the ref is still in a valid state.

8 years agofileops: save errno and report file existence
Carlos Martín Nieto [Thu, 24 Dec 2015 17:21:51 +0000 (17:21 +0000)]
fileops: save errno and report file existence

We need to save the errno, lest we clobber it in the giterr_set()
call. Also add code for reporting that a path component is missing,
which is a distinct failure mode.

8 years agorefdb: make ref deletion after pack safer
Carlos Martín Nieto [Thu, 24 Dec 2015 14:01:38 +0000 (14:01 +0000)]
refdb: make ref deletion after pack safer

In order not to undo concurrent modifications to references, we must
make sure that we only delete a loose reference if it still has the same
value as when we packed it.

This means we need to lock it and then compare the value with the one we
put in the packed file.

8 years agorefdb: bubble up errors
Carlos Martín Nieto [Thu, 24 Dec 2015 14:00:48 +0000 (14:00 +0000)]
refdb: bubble up errors

We can get useful information like GIT_ELOCKED out of this instead of
just -1.

8 years agorefdb: adjust the threading tests to what we promise
Carlos Martín Nieto [Thu, 24 Dec 2015 12:37:41 +0000 (12:37 +0000)]
refdb: adjust the threading tests to what we promise

We say it's going to work if you use a different repository in each
thread. Let's do precisely that in our code instead of hoping re-using
the refdb is going to work.

This test does fail currently, surfacing existing bugs.

8 years agorepository: do not interpret all files as gitlinks in discovery
Patrick Steinhardt [Fri, 11 Nov 2016 15:55:33 +0000 (16:55 +0100)]
repository: do not interpret all files as gitlinks in discovery

When trying to find a discovery, we walk up the directory
structure checking if there is a ".git" file or directory and, if
so, check its validity. But in the case that we've got a ".git"
file, we do not want to unconditionally assume that the file is
in fact a ".git" file and treat it as such, as we would error out
if it is not.

Fix the issue by only treating a file as a gitlink file if it
ends with "/.git". This allows users of the function to discover
a repository by handing in any path contained inside of a git
repository.

8 years agotest: discover: fix indentation
Patrick Steinhardt [Mon, 14 Nov 2016 09:52:37 +0000 (10:52 +0100)]
test: discover: fix indentation

8 years agotest: discover: split up monolithic test into smaller ones
Patrick Steinhardt [Fri, 11 Nov 2016 15:43:37 +0000 (16:43 +0100)]
test: discover: split up monolithic test into smaller ones

8 years agotest: discover: pass constants to ensure_repository_discover
Patrick Steinhardt [Fri, 11 Nov 2016 15:16:34 +0000 (16:16 +0100)]
test: discover: pass constants to ensure_repository_discover

8 years agotest: discover: move layout creation into test initializer
Patrick Steinhardt [Fri, 11 Nov 2016 14:50:14 +0000 (15:50 +0100)]
test: discover: move layout creation into test initializer

8 years agoMerge pull request #4002 from pks-t/pks/giterr-format
Carlos Martín Nieto [Mon, 14 Nov 2016 09:48:57 +0000 (10:48 +0100)]
Merge pull request #4002 from pks-t/pks/giterr-format

giterr format

8 years agoMerge pull request #3983 from pks-t/pks/smart-early-eof
Carlos Martín Nieto [Mon, 14 Nov 2016 09:39:45 +0000 (10:39 +0100)]
Merge pull request #3983 from pks-t/pks/smart-early-eof

transports: smart: abort on early end of stream

8 years agoMerge pull request #3985 from libgit2/cmn/threading-update
Carlos Martín Nieto [Mon, 14 Nov 2016 09:19:30 +0000 (10:19 +0100)]
Merge pull request #3985 from libgit2/cmn/threading-update

Update THREADING for OpenSSL 1.1

8 years agopath: pass string instead of git_buf to giterr_set
Patrick Steinhardt [Mon, 14 Nov 2016 09:07:13 +0000 (10:07 +0100)]
path: pass string instead of git_buf to giterr_set

8 years agocheckout: pass string instead of git_buf to `giterr_set`
Patrick Steinhardt [Mon, 14 Nov 2016 09:06:17 +0000 (10:06 +0100)]
checkout: pass string instead of git_buf to `giterr_set`

8 years agocommon: cast precision specifiers to int
Patrick Steinhardt [Mon, 14 Nov 2016 09:07:37 +0000 (10:07 +0100)]
common: cast precision specifiers to int

8 years agocommon: use PRIuZ for size_t in `giterr_set` calls
Patrick Steinhardt [Mon, 14 Nov 2016 09:05:31 +0000 (10:05 +0100)]
common: use PRIuZ for size_t in `giterr_set` calls