]> git.proxmox.com Git - libgit2.git/log
libgit2.git
7 years agoMake sure we use the `C` locale for `regcomp` on macOS.
Arthur Schreiber [Thu, 6 Oct 2016 11:15:31 +0000 (13:15 +0200)]
Make sure we use the `C` locale for `regcomp` on macOS.

7 years agoMerge pull request #3954 from libgit2/cmn/osx-ssh-key
Carlos Martín Nieto [Wed, 5 Oct 2016 21:46:02 +0000 (23:46 +0200)]
Merge pull request #3954 from libgit2/cmn/osx-ssh-key

Travis Mac SSH key issues

7 years agotravis: take the newer ssh-keygen format into account
Carlos Martín Nieto [Wed, 5 Oct 2016 18:17:06 +0000 (20:17 +0200)]
travis: take the newer ssh-keygen format into account

The Mac machines have updated their SSH version and so the ssh-keygen
format has changed. Ask it for MD5, which is the one that is output as
hex.

7 years agocibuild: set -x
Carlos Martín Nieto [Wed, 5 Oct 2016 16:52:43 +0000 (18:52 +0200)]
cibuild: set -x

This lets us see the details of what we're doing instead of just seeing the
output of unknown commands in the build output.

7 years agoMerge pull request #3931 from libgit2/ethomson/checkout_dont_calculate_oid_for_dirs
Edward Thomson [Sun, 2 Oct 2016 00:32:16 +0000 (19:32 -0500)]
Merge pull request #3931 from libgit2/ethomson/checkout_dont_calculate_oid_for_dirs

checkout: don't try to calculate oid for directories

7 years agocheckout: don't try to calculate oid for directories
Edward Thomson [Wed, 14 Sep 2016 09:28:24 +0000 (10:28 +0100)]
checkout: don't try to calculate oid for directories

When trying to determine if we can safely overwrite an existing workdir
item, we may need to calculate the oid for the workdir item to determine
if its identical to the old side (and eligible for removal).

We previously did this regardless of the type of entry in the workdir;
if it was a directory, we would open(2) it and then try to read(2).
The read(2) of a directory fails on many platforms, so we would treat it
as if it were unmodified and continue to perform the checkout.

On FreeBSD, you _can_ read(2) a directory, so this pattern failed.  We
would calculate an oid from the data read and determine that the
directory was modified and would therefore generate a checkout conflict.

This reliance on read(2) is silly (and was most likely accidentally
giving us the behavior we wanted), we should be explicit about the
directory test.

7 years agoMerge pull request #3929 from libgit2/vmg/time
Edward Thomson [Tue, 13 Sep 2016 14:16:20 +0000 (16:16 +0200)]
Merge pull request #3929 from libgit2/vmg/time

time: Export `git_time_monotonic`

7 years agotime: Export `git_time_monotonic`
Vicent Marti [Tue, 13 Sep 2016 13:52:43 +0000 (15:52 +0200)]
time: Export `git_time_monotonic`

7 years agoMerge pull request #3925 from pks-t/pks/cmake-library-dirs
Patrick Steinhardt [Fri, 9 Sep 2016 06:45:33 +0000 (08:45 +0200)]
Merge pull request #3925 from pks-t/pks/cmake-library-dirs

cmake: add curl library path

7 years agoMerge pull request #3923 from libgit2/ethomson/diff-read-empty-binary
Edward Thomson [Tue, 6 Sep 2016 15:43:21 +0000 (10:43 -0500)]
Merge pull request #3923 from libgit2/ethomson/diff-read-empty-binary

Read binary patches (with no binary data)

7 years agoMerge pull request #3882 from pks-t/pks/fix-fetch-refspec-dst-parsing
Patrick Steinhardt [Tue, 6 Sep 2016 09:21:29 +0000 (11:21 +0200)]
Merge pull request #3882 from pks-t/pks/fix-fetch-refspec-dst-parsing

refspec: do not set empty rhs for fetch refspecs

7 years agodiff: treat binary patches with no data special
Edward Thomson [Fri, 2 Sep 2016 07:03:45 +0000 (02:03 -0500)]
diff: treat binary patches with no data special

When creating and printing diffs, deal with binary deltas that have
binary data specially, versus diffs that have a binary file but lack the
actual binary data.

7 years agocmake: add curl library path
Patrick Steinhardt [Mon, 5 Sep 2016 11:24:07 +0000 (13:24 +0200)]
cmake: add curl library path

The `PKG_CHECK_MODULES` function searches a pkg-config module and
then proceeds to set various variables containing information on
how to link to the library. In contrast to the `FIND_PACKAGE`
function, the library path set by `PKG_CHECK_MODULES` will not
necessarily contain linking instructions with a complete path to
the library, though. So when a library is not installed in a
standard location, the linker might later fail due to being
unable to locate it.

While we already honor this when configuring libssh2 by adding
`LIBSSH2_LIBRARY_DIRS` to the link directories, we fail to do so
for libcurl, preventing us to build libgit2 on e.g. FreeBSD. Fix
the issue by adding the curl library directory to the linker
search path.

7 years agodiff_print: change test for skipping binary printing
Edward Thomson [Fri, 2 Sep 2016 16:26:16 +0000 (11:26 -0500)]
diff_print: change test for skipping binary printing

Instead of skipping printing a binary diff when there is no data, skip
printing when we have a status of `UNMODIFIED`.  This is more in-line
with our internal data model and allows us to expand the notion of
binary data.

In the future, there may have no data because the files were unmodified
(there was no data to produce) or it may have no data because there was
no data given to us in a patch.  We want to treat these cases
separately.

7 years agopatch: error on diff callback failure
Edward Thomson [Thu, 1 Sep 2016 21:55:27 +0000 (16:55 -0500)]
patch: error on diff callback failure

7 years agoMerge pull request #3922 from pks-t/pks/diff-only-load-binaries-when-requested
Edward Thomson [Fri, 2 Sep 2016 13:50:08 +0000 (08:50 -0500)]
Merge pull request #3922 from pks-t/pks/diff-only-load-binaries-when-requested

patch_generate: only calculate binary diffs if requested

7 years agopatch_generate: only calculate binary diffs if requested
Patrick Steinhardt [Thu, 1 Sep 2016 13:14:25 +0000 (15:14 +0200)]
patch_generate: only calculate binary diffs if requested

When generating diffs for binary files, we load and decompress
the blobs in order to generate the actual diff, which can be very
costly. While we cannot avoid this for the case when we are
called with the `GIT_DIFF_SHOW_BINARY` flag, we do not have to
load the blobs in the case where this flag is not set, as the
caller is expected to have no interest in the actual content of
binary files.

Fix the issue by only generating a binary diff when the caller is
actually interested in the diff. As libgit2 uses heuristics to
determine that a blob contains binary data by inspecting its size
without loading from the ODB, this saves us quite some time when
diffing in a repository with binary files.

7 years agoMerge pull request #3915 from pks-t/pks/index-collision-test-leak
Carlos Martín Nieto [Tue, 30 Aug 2016 10:11:02 +0000 (12:11 +0200)]
Merge pull request #3915 from pks-t/pks/index-collision-test-leak

tests: index: do not re-allocate index

7 years agoMerge pull request #3907 from steffhip/git_checkout_tree-fix
Patrick Steinhardt [Tue, 30 Aug 2016 06:22:17 +0000 (08:22 +0200)]
Merge pull request #3907 from steffhip/git_checkout_tree-fix

7 years agogit_checkout_tree options fix
Stefan Huber [Tue, 23 Aug 2016 23:20:39 +0000 (01:20 +0200)]
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.

7 years agoMerge pull request #3914 from pks-t/pks/libqgit2-binding-url
Edward Thomson [Mon, 29 Aug 2016 14:39:03 +0000 (09:39 -0500)]
Merge pull request #3914 from pks-t/pks/libqgit2-binding-url

README: adjust URL to libqgit2 repository

7 years agotests: index: do not re-allocate index
Patrick Steinhardt [Mon, 29 Aug 2016 11:09:58 +0000 (13:09 +0200)]
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.

7 years agoREADME: adjust URL to libqgit2 repository
Patrick Steinhardt [Mon, 29 Aug 2016 07:38:20 +0000 (09:38 +0200)]
README: adjust URL to libqgit2 repository

7 years agoMerge pull request #3900 from pks-t/pks/http-close-substream-on-connect
Patrick Steinhardt [Mon, 29 Aug 2016 07:29:34 +0000 (09:29 +0200)]
Merge pull request #3900 from pks-t/pks/http-close-substream-on-connect

transports: http: set substream as disconnected after closing

7 years agoMerge pull request #3908 from libgit2/ethomson/patch_from_diff
Edward Thomson [Fri, 26 Aug 2016 15:09:12 +0000 (10:09 -0500)]
Merge pull request #3908 from libgit2/ethomson/patch_from_diff

Teach `git_patch_from_diff` about parsed diffs

7 years agoTeach `git_patch_from_diff` about parsed diffs
Edward Thomson [Wed, 24 Aug 2016 04:38:39 +0000 (23:38 -0500)]
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.

7 years agoMerge pull request #3904 from stinb/filesystem-iterator-double-free
Patrick Steinhardt [Wed, 24 Aug 2016 06:28:49 +0000 (08:28 +0200)]
Merge pull request #3904 from stinb/filesystem-iterator-double-free

filesystem_iterator: fixed double free on error

7 years agofilesystem_iterator: fixed double free on error
Jason Haslam [Mon, 22 Aug 2016 15:27:47 +0000 (09:27 -0600)]
filesystem_iterator: fixed double free on error

7 years agoMerge pull request #3837 from novalis/dturner/indexv4
Edward Thomson [Wed, 17 Aug 2016 14:24:44 +0000 (09:24 -0500)]
Merge pull request #3837 from novalis/dturner/indexv4

Support index v4

7 years agoMerge pull request #3895 from pks-t/pks/negate-basename-in-subdirs
Edward Thomson [Wed, 17 Aug 2016 13:54:48 +0000 (08:54 -0500)]
Merge pull request #3895 from pks-t/pks/negate-basename-in-subdirs

ignore: allow unignoring basenames in subdirectories

7 years agotransports: http: reset `connected` flag when closing transport
Patrick Steinhardt [Wed, 17 Aug 2016 09:38:26 +0000 (11:38 +0200)]
transports: http: reset `connected` flag when closing transport

7 years agotransports: http: reset `connected` flag when re-connecting transport
Patrick Steinhardt [Wed, 17 Aug 2016 09:00:05 +0000 (11:00 +0200)]
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`.

7 years agoignore: allow unignoring basenames in subdirectories
Patrick Steinhardt [Fri, 12 Aug 2016 07:06:15 +0000 (09:06 +0200)]
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.

7 years agoindex: support index v4
David Turner [Tue, 17 May 2016 19:40:32 +0000 (15:40 -0400)]
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>
7 years agovarint: Add varint encoding/decoding
David Turner [Tue, 17 May 2016 19:40:46 +0000 (15:40 -0400)]
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>
7 years agoMerge pull request #3891 from pks-t/pks/stransport-memory-management-improvements
Carlos Martín Nieto [Tue, 9 Aug 2016 12:34:55 +0000 (14:34 +0200)]
Merge pull request #3891 from pks-t/pks/stransport-memory-management-improvements

stransport memory management improvements

7 years agoMerge pull request #3893 from pks-t/pks/remove-unused-test-cb
Edward Thomson [Tue, 9 Aug 2016 12:07:10 +0000 (08:07 -0400)]
Merge pull request #3893 from pks-t/pks/remove-unused-test-cb

tests: blob: remove unused callback function

7 years agotests: blob: remove unused callback function
Patrick Steinhardt [Tue, 9 Aug 2016 08:09:23 +0000 (10:09 +0200)]
tests: blob: remove unused callback function

7 years agostransport: do not use `git_stream_free` on uninitialized stransport
Patrick Steinhardt [Mon, 8 Aug 2016 12:47:32 +0000 (14:47 +0200)]
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.

7 years agoMerge pull request #3887 from libgit2/ethomson/empty_blob
Carlos Martín Nieto [Mon, 8 Aug 2016 13:13:59 +0000 (15:13 +0200)]
Merge pull request #3887 from libgit2/ethomson/empty_blob

odb: only provide the empty tree

7 years agoMerge pull request #3890 from pks-t/pks/stransport-static-linkage
Edward Thomson [Mon, 8 Aug 2016 12:42:32 +0000 (08:42 -0400)]
Merge pull request #3890 from pks-t/pks/stransport-static-linkage

stransport: make internal functions static

7 years agostransport: make internal functions static
Patrick Steinhardt [Mon, 8 Aug 2016 11:49:17 +0000 (13:49 +0200)]
stransport: make internal functions static

7 years agoMerge pull request #3888 from libgit2/ethomson/doc_diff_from_buffer
Carlos Martín Nieto [Mon, 8 Aug 2016 11:12:51 +0000 (13:12 +0200)]
Merge pull request #3888 from libgit2/ethomson/doc_diff_from_buffer

diff: document `git_diff_from_buffer`

7 years agoodb: actually insert the empty blob in tests
Edward Thomson [Sat, 6 Aug 2016 00:34:19 +0000 (20:34 -0400)]
odb: actually insert the empty blob in tests

7 years agodiff: document `git_diff_from_buffer`
Edward Thomson [Sat, 6 Aug 2016 00:00:22 +0000 (20:00 -0400)]
diff: document `git_diff_from_buffer`

7 years agoodb: only provide the empty tree
Edward Thomson [Fri, 5 Aug 2016 23:30:56 +0000 (19:30 -0400)]
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).

7 years agoMerge pull request #3886 from libgit2/cmn/copypeertrust-null
Edward Thomson [Fri, 5 Aug 2016 18:23:29 +0000 (14:23 -0400)]
Merge pull request #3886 from libgit2/cmn/copypeertrust-null

SecureTransport: handle NULL trust on success

7 years agoSecureTransport: handle NULL trust on success
Carlos Martín Nieto [Fri, 5 Aug 2016 16:40:37 +0000 (18:40 +0200)]
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.

7 years agoMerge pull request #3881 from pks-t/pks/fix-clar-suite-prefix-computation
Carlos Martín Nieto [Fri, 5 Aug 2016 16:24:28 +0000 (18:24 +0200)]
Merge pull request #3881 from pks-t/pks/fix-clar-suite-prefix-computation

clar: fix parsing of test suite prefixes

7 years agoMerge pull request #3884 from pks-t/pks/patch-image-initialization
Edward Thomson [Fri, 5 Aug 2016 13:10:58 +0000 (09:10 -0400)]
Merge pull request #3884 from pks-t/pks/patch-image-initialization

Patch image initialization

7 years agoapply: fix warning when initializing patch images
Patrick Steinhardt [Fri, 5 Aug 2016 08:57:42 +0000 (10:57 +0200)]
apply: fix warning when initializing patch images

7 years agopool: provide macro to statically initialize git_pool
Patrick Steinhardt [Fri, 5 Aug 2016 08:57:13 +0000 (10:57 +0200)]
pool: provide macro to statically initialize git_pool

7 years agoMerge pull request #3861 from libgit2/ethomson/refresh_objects
Edward Thomson [Thu, 4 Aug 2016 20:16:16 +0000 (16:16 -0400)]
Merge pull request #3861 from libgit2/ethomson/refresh_objects

odb: freshen existing objects when writing

7 years agoodb: only freshen pack files every 2 seconds
Edward Thomson [Fri, 22 Jul 2016 17:34:19 +0000 (13:34 -0400)]
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.

7 years agoodb: freshen existing objects when writing
Edward Thomson [Thu, 14 Jul 2016 20:23:24 +0000 (16:23 -0400)]
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.

7 years agoMerge pull request #3877 from libgit2/ethomson/paths_init
Carlos Martín Nieto [Thu, 4 Aug 2016 18:49:50 +0000 (20:49 +0200)]
Merge pull request #3877 from libgit2/ethomson/paths_init

sysdir: don't assume an empty dir is uninitialized

7 years agoMerge pull request #3869 from richardipsum/fix-outdated-comment
Edward Thomson [Thu, 4 Aug 2016 17:20:49 +0000 (13:20 -0400)]
Merge pull request #3869 from richardipsum/fix-outdated-comment

Fix outdated comment

7 years agoMerge pull request #3850 from wildart/custom-tls
Edward Thomson [Thu, 4 Aug 2016 16:45:19 +0000 (12:45 -0400)]
Merge pull request #3850 from wildart/custom-tls

Enable https transport for custom TLS streams

7 years agosysdir: use the standard `init` pattern
Edward Thomson [Fri, 29 Jul 2016 16:59:42 +0000 (12:59 -0400)]
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.

7 years agoMerge pull request #3879 from libgit2/ethomson/mwindow_init
Edward Thomson [Thu, 4 Aug 2016 15:51:06 +0000 (11:51 -0400)]
Merge pull request #3879 from libgit2/ethomson/mwindow_init

mwindow: init mwindow files in git_libgit2_init

7 years agomwindow: init mwindow files in git_libgit2_init
Edward Thomson [Wed, 3 Aug 2016 21:01:48 +0000 (17:01 -0400)]
mwindow: init mwindow files in git_libgit2_init

7 years agorefspec: do not set empty rhs for fetch refspecs
Patrick Steinhardt [Thu, 4 Aug 2016 11:45:28 +0000 (13:45 +0200)]
refspec: do not set empty rhs for fetch refspecs

According to git-fetch(1), "[t]he colon can be omitted when <dst>
is empty." So according to git, the refspec "refs/heads/master"
is the same as the refspec "refs/heads/master:" when fetching
changes. When trying to fetch from a remote with a trailing
colon with libgit2, though, the fetch actually fails while it
works when the trailing colon is left out. So obviously, libgit2
does _not_ treat these two refspec formats the same for fetches.

The problem results from parsing refspecs, where the resulting
refspec has its destination set to an empty string in the case of
a trailing colon and to a `NULL` pointer in the case of no
trailing colon. When passing this to our DWIM machinery, the
empty string gets translated to "refs/heads/", which is simply
wrong.

Fix the problem by having the parsing machinery treat both cases
the same for fetch refspecs.

7 years agoclar: fix parsing of test suite prefixes
Patrick Steinhardt [Thu, 4 Aug 2016 09:49:39 +0000 (11:49 +0200)]
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.

7 years agoMerge pull request #3880 from libgit2/ethomson/diff_file
Edward Thomson [Thu, 4 Aug 2016 02:00:21 +0000 (22:00 -0400)]
Merge pull request #3880 from libgit2/ethomson/diff_file

git_diff_file: move `id_abbrev`

7 years agogit_diff_file: move `id_abbrev`
Edward Thomson [Wed, 3 Aug 2016 21:09:41 +0000 (17:09 -0400)]
git_diff_file: move `id_abbrev`

Move `id_abbrev` to a more reasonable place where it packs more nicely
(before anybody starts using it).

7 years agoMerge pull request #3865 from libgit2/ethomson/leaks
Edward Thomson [Tue, 2 Aug 2016 22:43:12 +0000 (18:43 -0400)]
Merge pull request #3865 from libgit2/ethomson/leaks

Fix leaks, some warnings and an error

7 years agocrlf: set a safe crlf default
Edward Thomson [Sun, 24 Jul 2016 20:10:30 +0000 (16:10 -0400)]
crlf: set a safe crlf default

7 years agoMerge pull request #3815 from pks-t/pks/coverity-model
Edward Thomson [Sun, 24 Jul 2016 20:05:17 +0000 (16:05 -0400)]
Merge pull request #3815 from pks-t/pks/coverity-model

Coverity user model

7 years agoMerge pull request #3862 from novalis/dturner/do-not-die-on-missing-config
Edward Thomson [Sun, 24 Jul 2016 19:51:13 +0000 (15:51 -0400)]
Merge pull request #3862 from novalis/dturner/do-not-die-on-missing-config

remote: Handle missing config values when deleting a remote

7 years agorepository: don't cast to `int` for no reason
Edward Thomson [Fri, 22 Jul 2016 18:02:00 +0000 (14:02 -0400)]
repository: don't cast to `int` for no reason

And give it a default so that some compilers don't (unnecessarily)
complain.

7 years agoindex: cast to avoid warning
Edward Thomson [Fri, 22 Jul 2016 16:53:13 +0000 (12:53 -0400)]
index: cast to avoid warning

7 years agotests: use a `size_t`
Edward Thomson [Fri, 22 Jul 2016 16:01:24 +0000 (12:01 -0400)]
tests: use a `size_t`

7 years agopackbuilder: `size_t` all the things
Edward Thomson [Fri, 15 Jul 2016 21:18:39 +0000 (17:18 -0400)]
packbuilder: `size_t` all the things

After 1cd65991, we were passing a pointer to an `unsigned long` to
a function that now expected a pointer to a `size_t`.  These types
differ on 64-bit Windows, which means that we trash the stack.

Use `size_t`s in the packbuilder to avoid this.

7 years agoapply: safety check files that dont end with eol
Edward Thomson [Fri, 15 Jul 2016 03:32:35 +0000 (23:32 -0400)]
apply: safety check files that dont end with eol

7 years agoapply: check allocation properly
Edward Thomson [Fri, 15 Jul 2016 03:04:47 +0000 (23:04 -0400)]
apply: check allocation properly

7 years agoapply: compare preimage to image
Edward Thomson [Fri, 15 Jul 2016 02:59:37 +0000 (22:59 -0400)]
apply: compare preimage to image

Compare the preimage to the image; don't compare the preimage to itself.

7 years agorepo::open: remove dead code, free buffers
Edward Thomson [Fri, 15 Jul 2016 16:43:57 +0000 (12:43 -0400)]
repo::open: remove dead code, free buffers

7 years agoMerge pull request #3868 from libgit2/ethomson/mac_build
Edward Thomson [Sun, 24 Jul 2016 19:47:58 +0000 (15:47 -0400)]
Merge pull request #3868 from libgit2/ethomson/mac_build

ci: point to the homebrew libssh2 install

7 years agoci: install homebrew's curl on mac
Edward Thomson [Sun, 24 Jul 2016 18:51:28 +0000 (14:51 -0400)]
ci: install homebrew's curl on mac

7 years agoMake comment conform to style guide
Richard Ipsum [Sat, 23 Jul 2016 10:55:43 +0000 (11:55 +0100)]
Make comment conform to style guide

Style guide says // style comments should be avoided.

7 years agoFix outdated comment
Richard Ipsum [Sat, 23 Jul 2016 10:47:59 +0000 (11:47 +0100)]
Fix outdated comment

SSH transport seems to be supported now.

7 years agoci: install homebrew's zlib on mac
Edward Thomson [Fri, 22 Jul 2016 21:45:03 +0000 (17:45 -0400)]
ci: install homebrew's zlib on mac

7 years agoremote: Handle missing config values when deleting a remote
David Turner [Fri, 15 Jul 2016 17:32:23 +0000 (13:32 -0400)]
remote: Handle missing config values when deleting a remote

Somehow I ended up with the following in my ~/.gitconfig:
[branch "master"]
remote = origin
merge = master
rebase = true

I assume something went crazy while I was running the git.git tests
some time ago, and that I never noticed until now.

This is not a good configuration, but it shouldn't cause problems. But
it does. Specifically, if you have this in your config, and you
perform the following set of actions:

create a remote
fetch from that remote
create a branch off of the remote master branch called "master"
delete the branch
delete the remote

The remote delete fails with the message "Could not find key
'branch.master.rebase' to delete". This is because it's iterating over
the config entries (including the ones in the global config) and
believes that there is a master branch which must therefore have these
config keys.

https://github.com/libgit2/libgit2/issues/3856

7 years agoremove conditions that prevent use of custom TLS stream
wildart [Wed, 6 Jul 2016 17:06:25 +0000 (13:06 -0400)]
remove conditions that prevent use of custom TLS stream

7 years agoMerge pull request #3851 from txdv/get-user-agent
Edward Thomson [Tue, 5 Jul 2016 19:51:01 +0000 (15:51 -0400)]
Merge pull request #3851 from txdv/get-user-agent

Add get user agent functionality.

7 years agoMerge pull request #3846 from rkrp/fix_bug_parsing_int64min
Edward Thomson [Tue, 5 Jul 2016 16:46:27 +0000 (12:46 -0400)]
Merge pull request #3846 from rkrp/fix_bug_parsing_int64min

Fixed bug while parsing INT64_MIN

7 years agoAdd get user agent functionality.
Andrius Bentkus [Tue, 5 Jul 2016 06:41:51 +0000 (09:41 +0300)]
Add get user agent functionality.

7 years agoMerge pull request #3836 from joshtriplett/cleanup-find_repo
Edward Thomson [Fri, 1 Jul 2016 22:47:06 +0000 (18:47 -0400)]
Merge pull request #3836 from joshtriplett/cleanup-find_repo

find_repo: Clean up and simplify logic

7 years agoMerge pull request #3711 from joshtriplett/git_repository_discover_default
Edward Thomson [Fri, 1 Jul 2016 22:45:10 +0000 (18:45 -0400)]
Merge pull request #3711 from joshtriplett/git_repository_discover_default

Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars

7 years agoCHANGELOG.md: Document new flags for git_repository_open_ext
Josh Triplett [Thu, 30 Jun 2016 15:08:36 +0000 (08:08 -0700)]
CHANGELOG.md: Document new flags for git_repository_open_ext

Document GIT_REPOSITORY_OPEN_NO_DOTGIT and GIT_REPOSITORY_OPEN_FROM_ENV.

7 years agoCHANGELOG.md: Document behavior change in repository discovery
Josh Triplett [Thu, 30 Jun 2016 15:08:06 +0000 (08:08 -0700)]
CHANGELOG.md: Document behavior change in repository discovery

7 years agoMerge pull request #3847 from libgit2/ethomson/read_index_conflicts
Edward Thomson [Thu, 30 Jun 2016 14:20:32 +0000 (10:20 -0400)]
Merge pull request #3847 from libgit2/ethomson/read_index_conflicts

Include conflicts in `git_index_read_index`

7 years agoindex: include conflicts in `git_index_read_index`
Edward Thomson [Wed, 29 Jun 2016 21:55:44 +0000 (17:55 -0400)]
index: include conflicts in `git_index_read_index`

Ensure that we include conflicts when calling `git_index_read_index`,
which will remove conflicts in the index that do not exist in the new
target, and will add conflicts from the new target.

7 years agoindex: refactor common `read_index` functionality
Edward Thomson [Wed, 29 Jun 2016 21:01:47 +0000 (17:01 -0400)]
index: refactor common `read_index` functionality

Most of `git_index_read_index` is common to reading any iterator.
Refactor it out in case we want to implement `read_tree` in terms of it
in the future.

7 years agoMerge pull request #3813 from stinb/submodule-update-fetch
Edward Thomson [Wed, 29 Jun 2016 14:01:26 +0000 (10:01 -0400)]
Merge pull request #3813 from stinb/submodule-update-fetch

submodule: Try to fetch when update fails to find the target commit.

7 years agoMerge pull request #3842 from pks-t/pks/double-free
Edward Thomson [Wed, 29 Jun 2016 13:35:56 +0000 (09:35 -0400)]
Merge pull request #3842 from pks-t/pks/double-free

blame: increment reference count for origin's commit

7 years agoblame: do not decrement commit refcount in make_origin
Patrick Steinhardt [Mon, 27 Jun 2016 13:20:20 +0000 (15:20 +0200)]
blame: do not decrement commit refcount in make_origin

When we create a blame origin, we try to look up the blob that is
to be blamed at a certain revision. When this lookup fails, e.g.
because the file did not exist at that certain revision, we fail
to create the blame origin and return `NULL`. The blame origin
that we have just allocated is thereby free'd with
`origin_decref`.

The `origin_decref` function does not only decrement reference
counts for the blame origin, though, but also for its commit and
blob. When this is done in the error case, we will cause an
uneven reference count for these objects. This may result in
hard-to-debug failures at seemingly unrelated code paths, where
we try to access these objects when they in fact have already
been free'd.

Fix the issue by refactoring `make_origin` such that we only
allocate the object after the only function that may fail so that
we do not have to call `origin_decref` at all. Also fix the
`pass_blame` function, which indirectly calls `make_origin`, to
free the commit when `make_origin` failed.

7 years agoFixed bug while parsing INT64_MIN
Krishna Ram Prakash R [Tue, 28 Jun 2016 14:49:52 +0000 (20:19 +0530)]
Fixed bug while parsing INT64_MIN

7 years agosubmodule: Try to fetch when update fails to find the target commit in the submodule.
Jason Haslam [Tue, 28 Jun 2016 22:07:25 +0000 (16:07 -0600)]
submodule: Try to fetch when update fails to find the target commit in the submodule.

7 years agoMerge pull request #3223 from ethomson/apply
Edward Thomson [Sun, 26 Jun 2016 03:33:05 +0000 (23:33 -0400)]
Merge pull request #3223 from ethomson/apply

Reading patch files