]> git.proxmox.com Git - libgit2.git/log
libgit2.git
8 years agoAdd more tests for path matching with globs and path delimiters
Antonio Scandurra [Thu, 31 Mar 2016 15:38:40 +0000 (17:38 +0200)]
Add more tests for path matching with globs and path delimiters

8 years agoMerge pull request #3740 from Qix-/patch-1
Carlos Martín Nieto [Wed, 13 Apr 2016 09:51:05 +0000 (11:51 +0200)]
Merge pull request #3740 from Qix-/patch-1

Add missing ')' to callbacks documentation

8 years agoAdd missing ')' to callbacks documentation
Josh Junon [Wed, 13 Apr 2016 04:50:18 +0000 (21:50 -0700)]
Add missing ')' to callbacks documentation

Super minor, but it was bugging me.

There was a missing closing paren in the docs.

8 years agoMerge pull request #3738 from ethomson/test_as_root
Carlos Martín Nieto [Mon, 11 Apr 2016 22:14:00 +0000 (00:14 +0200)]
Merge pull request #3738 from ethomson/test_as_root

tests: skip the unreadable file tests as root

8 years agotests: skip the unreadable file tests as root
Edward Thomson [Mon, 11 Apr 2016 17:39:31 +0000 (13:39 -0400)]
tests: skip the unreadable file tests as root

When running as root, skip the unreadable file tests, because, well,
they're probably _not_ unreadable to root unless you've got some
crazy NSA clearance-level honoring operating system shit going on.

8 years agoMerge pull request #3736 from libgit2/cmn/dwim-general-message
Edward Thomson [Mon, 11 Apr 2016 17:29:54 +0000 (13:29 -0400)]
Merge pull request #3736 from libgit2/cmn/dwim-general-message

refs: provide a more general error message for dwim

8 years agoMerge pull request #3737 from ethomson/strict-object
Carlos Martín Nieto [Mon, 11 Apr 2016 17:24:47 +0000 (19:24 +0200)]
Merge pull request #3737 from ethomson/strict-object

Strict object creation in `refs::create`

8 years agorefs::create: strict object creation on by default
Edward Thomson [Mon, 11 Apr 2016 15:50:11 +0000 (11:50 -0400)]
refs::create: strict object creation on by default

When we turned strict object creation validation on by default, we
forgot to inform the refs::create tests of this.  They, in fact,
believed that strict object creation was off by default.  As a result,
their cleanup function went and turned strict object creation off for
the remaining tests.

8 years agoreset: use real ids for the tests
Carlos Martín Nieto [Mon, 11 Apr 2016 09:37:02 +0000 (11:37 +0200)]
reset: use real ids for the tests

This lets us run with strict object creation on.

8 years agorefs: provide a more general error message for dwim
Carlos Martín Nieto [Mon, 11 Apr 2016 15:43:07 +0000 (17:43 +0200)]
refs: provide a more general error message for dwim

If we cannot dwim the input, set the error message to be explicit about
that. Otherwise we leave the error for the last failed lookup, which
can be rather unexpected as it mentions a remote when the user thought
they were trying to look up a branch.

8 years agoMerge pull request #3730 from andhe/fix-stream-test
Edward Thomson [Wed, 6 Apr 2016 19:59:31 +0000 (15:59 -0400)]
Merge pull request #3730 from andhe/fix-stream-test

tests: fix core/stream test when built with openssl off

8 years agotests: fix core/stream test when built with openssl off
Andreas Henriksson [Wed, 6 Apr 2016 08:37:30 +0000 (10:37 +0200)]
tests: fix core/stream test when built with openssl off

When passing -DUSE_OPENSSL:BOOL=OFF to cmake the testsuite will
fail with the following error:

core::stream::register_tls [/tmp/libgit2/tests/core/stream.c:40]
  Function call failed: (error)
  error -1 - <no message>

Fix test to assume failure for tls when built without openssl.
While at it also fix GIT_WIN32 cpp to check if it's defined
or not.

8 years agoMerge pull request #3728 from libgit2/cmn/no-embed
Edward Thomson [Tue, 5 Apr 2016 18:47:02 +0000 (14:47 -0400)]
Merge pull request #3728 from libgit2/cmn/no-embed

Remove Makefile.embed

8 years agoRemove Makefile.embed
Carlos Martín Nieto [Tue, 5 Apr 2016 17:25:23 +0000 (13:25 -0400)]
Remove Makefile.embed

This has not been a supported build mode for quite some time, and it
correspondingly hasn't worked to build the library for a long time. Get
rid of it, as the only build mode we support is though CMakek.

8 years agoMerge pull request #3724 from ethomson/submodule_start_supports_silly_slashes
Carlos Martín Nieto [Sun, 3 Apr 2016 05:19:42 +0000 (22:19 -0700)]
Merge pull request #3724 from ethomson/submodule_start_supports_silly_slashes

iterator/diff: allow trailing `/` on start/end paths to match submodules

8 years agoMerge pull request #3723 from libgit2/cmn/ignore-symlink
Edward Thomson [Sat, 2 Apr 2016 20:52:53 +0000 (16:52 -0400)]
Merge pull request #3723 from libgit2/cmn/ignore-symlink

ignore: don't use realpath to canonicalize path

8 years agoiterator: support trailing `/` in start for submod
Edward Thomson [Sat, 2 Apr 2016 20:03:09 +0000 (13:03 -0700)]
iterator: support trailing `/` in start for submod

Allow callers to specify a start path with a trailing slash to match
a submodule, instead of just a directory.  This is for some legacy
behavior that's sort of dumb, but there it is.

8 years agodiff: test submodules are found with trailing `/`
Edward Thomson [Sat, 2 Apr 2016 18:33:00 +0000 (11:33 -0700)]
diff: test submodules are found with trailing `/`

Test that submodules are found when the are included in a pathspec
but have a trailing slash.

8 years agoignore: don't use realpath to canonicalize path
Carlos Martín Nieto [Fri, 1 Apr 2016 12:33:42 +0000 (14:33 +0200)]
ignore: don't use realpath to canonicalize path

If we're looking for a symlink, realpath will give us the resolved path,
which is not what we're after, but a canonicalized version of the path
the user asked for.

8 years agoMerge pull request #3720 from pks-t/pks/merge-driver-memleaks
Carlos Martín Nieto [Fri, 1 Apr 2016 11:09:50 +0000 (04:09 -0700)]
Merge pull request #3720 from pks-t/pks/merge-driver-memleaks

merge_driver: fix missing `goto done;`

8 years agomerge_driver: fix missing `goto done;`
Patrick Steinhardt [Fri, 1 Apr 2016 07:37:55 +0000 (09:37 +0200)]
merge_driver: fix missing `goto done;`

The code initializing the merge driver registry accidentally
forgot a `goto done` in case of an error. Because of this the
next line, which registers the global shutdown callback for the
merge drivers, is only called when an error occured.

Fix this by adding the missing `goto done`. This fixes some
memory leaks when the global state is shut down.

8 years agoMerge pull request #3719 from libgit2/ethomson/submodule_status
Carlos Martín Nieto [Fri, 1 Apr 2016 07:29:51 +0000 (00:29 -0700)]
Merge pull request #3719 from libgit2/ethomson/submodule_status

WD iterator: properly identify submodules

8 years agoiterator: use correct search function
Edward Thomson [Thu, 31 Mar 2016 19:05:34 +0000 (15:05 -0400)]
iterator: use correct search function

8 years agostatus: test submodules with mixed case
Edward Thomson [Thu, 31 Mar 2016 21:33:44 +0000 (17:33 -0400)]
status: test submodules with mixed case

8 years agoMerge pull request #3717 from libgit2/ethomson/leaks
Carlos Martín Nieto [Thu, 31 Mar 2016 21:04:43 +0000 (14:04 -0700)]
Merge pull request #3717 from libgit2/ethomson/leaks

Plug some leaks

8 years agoleaks: call `xdl_free_classifier`
Edward Thomson [Thu, 31 Mar 2016 14:43:57 +0000 (10:43 -0400)]
leaks: call `xdl_free_classifier`

8 years agoleaks: fix some leaks in the tests
Edward Thomson [Wed, 30 Mar 2016 21:47:05 +0000 (17:47 -0400)]
leaks: fix some leaks in the tests

8 years agoleaks: fix some iterator leaks
Edward Thomson [Wed, 30 Mar 2016 21:41:08 +0000 (17:41 -0400)]
leaks: fix some iterator leaks

8 years agoPlug a few leaks
Carlos Martín Nieto [Tue, 29 Mar 2016 12:47:31 +0000 (14:47 +0200)]
Plug a few leaks

8 years agoMerge pull request #3716 from libgit2/cmn/typedef-sizet
Edward Thomson [Thu, 31 Mar 2016 14:04:43 +0000 (10:04 -0400)]
Merge pull request #3716 from libgit2/cmn/typedef-sizet

Add a no-op size_t typedef for the doc parser

8 years agoMerge pull request #3575 from pmq20/master-13jan16
Carlos Martín Nieto [Thu, 31 Mar 2016 11:12:46 +0000 (04:12 -0700)]
Merge pull request #3575 from pmq20/master-13jan16

Remove duplicated calls to git_mwindow_close

8 years agoMerge pull request #3715 from pks-t/pks/xprepare-memleak
Carlos Martín Nieto [Thu, 31 Mar 2016 10:50:11 +0000 (03:50 -0700)]
Merge pull request #3715 from pks-t/pks/xprepare-memleak

xprepare memleaks

8 years agoAdd a no-op size_t typedef for the doc parser
Carlos Martín Nieto [Thu, 31 Mar 2016 09:35:53 +0000 (11:35 +0200)]
Add a no-op size_t typedef for the doc parser

Clang's documentation parser, which we use in our documentation system
does not report any comments for functions which use size_t as a type.

The root cause is buried somewhere in libclang but we can work around it
by defining the type ourselves. This typedef makes sure that libclang
sees it and that we do not change its size.

8 years agoxdiff/xprepare: fix a memory leak
Patrick Steinhardt [Thu, 31 Mar 2016 09:32:36 +0000 (11:32 +0200)]
xdiff/xprepare: fix a memory leak

The xdl_prepare_env() function may initialise an xdlclassifier_t
data structure via xdl_init_classifier(), which allocates memory
to several fields, for example 'rchash', 'rcrecs' and 'ncha'.
If this function later exits due to the failure of xdl_optimize_ctxs(),
then this xdlclassifier_t structure, and the memory allocated to it,
is not cleaned up.

In order to fix the memory leak, insert a call to xdl_free_classifier()
before returning.

This patch was originally written by Ramsay Jones (see commit
87f16258367a3b9a62663b11f898a4a6f3c19d31 in git.git).

8 years agoxdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bits
Patrick Steinhardt [Thu, 31 Mar 2016 09:30:31 +0000 (11:30 +0200)]
xdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bits

Commit 307ab20b3 ("xdiff: PATIENCE/HISTOGRAM are not independent option
bits", 19-02-2012) introduced the XDF_DIFF_ALG() macro to access the
flag bits used to represent the diff algorithm requested. In addition,
code which had used explicit manipulation of the flag bits was changed
to use the macros.

However, one example of direct manipulation remains. Update this code to
use the XDF_DIFF_ALG() macro.

This patch was originally written by Ramsay Jones (see commit
5cd6978a9cfef58de061a9525f3678ade479564d in git.git).

8 years agoMerge pull request #3712 from ethomson/config_duplicate_section
Carlos Martín Nieto [Tue, 29 Mar 2016 10:26:43 +0000 (03:26 -0700)]
Merge pull request #3712 from ethomson/config_duplicate_section

config: don't write duplicate section

8 years agoMerge pull request #3703 from libgit2/cmn/multivar-set-locked
Edward Thomson [Mon, 28 Mar 2016 17:51:21 +0000 (13:51 -0400)]
Merge pull request #3703 from libgit2/cmn/multivar-set-locked

config: don't special-case multivars that don't exist yet

8 years agoconfig::write::repeated: init our buffer
Edward Thomson [Mon, 28 Mar 2016 15:56:13 +0000 (08:56 -0700)]
config::write::repeated: init our buffer

8 years agoconfig: don't write section header if we're in it
Edward Thomson [Mon, 28 Mar 2016 15:13:51 +0000 (11:13 -0400)]
config: don't write section header if we're in it

If we hit the EOF while trying to write a new value, it may be that
we're already in the section that we were looking for.  If so, do not
write a (duplicate) section header, just write the value.

8 years agoconfig: show we write a spurious duplicated section header
Carlos Martín Nieto [Fri, 4 Mar 2016 13:51:16 +0000 (14:51 +0100)]
config: show we write a spurious duplicated section header

We should notice that we are in the correct section to add. This is a
cosmetic bug, since replacing any of these settings does work.

8 years agoMerge pull request #3708 from sschuberth/master
Edward Thomson [Mon, 28 Mar 2016 13:50:31 +0000 (09:50 -0400)]
Merge pull request #3708 from sschuberth/master

CMakeLists: Further improve the error messages regarding CMAKE_SIZEOF_VOID_P

8 years agoMerge pull request #3691 from ethomson/iterators
Carlos Martín Nieto [Sat, 26 Mar 2016 12:39:07 +0000 (05:39 -0700)]
Merge pull request #3691 from ethomson/iterators

Some FANTASTIC iterator refactoring

8 years agoiterator: comment fixed
Marc Strapetz [Tue, 22 Mar 2016 09:30:07 +0000 (10:30 +0100)]
iterator: comment fixed

8 years agoiterator: unused includes removed
Marc Strapetz [Tue, 22 Mar 2016 09:29:41 +0000 (10:29 +0100)]
iterator: unused includes removed

8 years agoiterator: new workdir-iterator test for pathlist + includings trees
Marc Strapetz [Tue, 22 Mar 2016 09:29:12 +0000 (10:29 +0100)]
iterator: new workdir-iterator test for pathlist + includings trees

8 years agoiterator: new index-iterator test for pathlist + includings trees
Marc Strapetz [Tue, 22 Mar 2016 09:28:50 +0000 (10:28 +0100)]
iterator: new index-iterator test for pathlist + includings trees

8 years agoiterator: more pathlist-related tests should test actual paths
Marc Strapetz [Tue, 22 Mar 2016 09:27:50 +0000 (10:27 +0100)]
iterator: more pathlist-related tests should test actual paths

8 years agoiterator: cleanups
Edward Thomson [Mon, 21 Mar 2016 21:19:24 +0000 (17:19 -0400)]
iterator: cleanups

Remove some unused functions, refactor some ugliness.

8 years agoiterator: don't run the gunk test by default on CI
Edward Thomson [Mon, 21 Mar 2016 22:30:21 +0000 (18:30 -0400)]
iterator: don't run the gunk test by default on CI

(It's slow!)

8 years agoiterator: refactor empty iterator to new style
Edward Thomson [Mon, 21 Mar 2016 21:03:00 +0000 (17:03 -0400)]
iterator: refactor empty iterator to new style

8 years agoiterator: mandate `advance_over`
Edward Thomson [Mon, 21 Mar 2016 20:51:45 +0000 (16:51 -0400)]
iterator: mandate `advance_over`

Since the three iterators implement `advance_over` differently,
mandate it and implement each.

8 years agoiterator: refactor index iterator
Edward Thomson [Mon, 21 Mar 2016 16:54:47 +0000 (12:54 -0400)]
iterator: refactor index iterator

8 years agoIntroduce `git_path_common_dirlen`
Edward Thomson [Fri, 18 Mar 2016 21:33:46 +0000 (17:33 -0400)]
Introduce `git_path_common_dirlen`

8 years agoiterator: move the index into the iterator itself
Edward Thomson [Fri, 18 Mar 2016 16:59:35 +0000 (12:59 -0400)]
iterator: move the index into the iterator itself

8 years agoiterator: give the tests a proper hierarchy
Edward Thomson [Fri, 18 Mar 2016 14:59:38 +0000 (10:59 -0400)]
iterator: give the tests a proper hierarchy

Iterator tests were split over repo::iterator and diff::iterator,
with duplication between the two.  Move them to iterator::index,
iterator::tree, and iterator::workdir.

8 years agoMerge pull request #3574 from chescock/buffer-sideband-pack-data
Carlos Martín Nieto [Thu, 24 Mar 2016 13:56:25 +0000 (06:56 -0700)]
Merge pull request #3574 from chescock/buffer-sideband-pack-data

Buffer sideband packet data

8 years agoCMakeLists: Further improve the error messages regarding CMAKE_SIZEOF_VOID_P
Sebastian Schuberth [Thu, 24 Mar 2016 13:10:29 +0000 (14:10 +0100)]
CMakeLists: Further improve the error messages regarding CMAKE_SIZEOF_VOID_P

8 years agoAdded clar test for #3568
Jeff Hostetler [Mon, 4 Jan 2016 17:12:24 +0000 (12:12 -0500)]
Added clar test for #3568

8 years agodiff: stop processing nitem when its removed
Edward Thomson [Thu, 17 Mar 2016 19:29:21 +0000 (15:29 -0400)]
diff: stop processing nitem when its removed

When a directory is removed out from underneath us, stop trying to
manipulate it.

8 years agoiterator: drop `advance_into_or_over`
Edward Thomson [Thu, 17 Mar 2016 19:19:45 +0000 (15:19 -0400)]
iterator: drop `advance_into_or_over`

Now that iterators do not return `GIT_ENOTFOUND` when advancing
into an empty directory, we do not need a special `advance_into_or_over`
function.

8 years agoiterator: test that we can `advance_into` empty dirs
Edward Thomson [Thu, 17 Mar 2016 19:09:38 +0000 (15:09 -0400)]
iterator: test that we can `advance_into` empty dirs

Prior iterator implementations returned `GIT_ENOTFOUND` when
trying to advance into empty directories.  Ensure that we no longer
do that and simply handle them gracefully.

8 years agoFailing test.
joshaber [Wed, 10 Feb 2016 18:46:14 +0000 (13:46 -0500)]
Failing test.

8 years agoiterator: test pathlist handling for directories
Marc Strapetz [Wed, 16 Mar 2016 10:38:02 +0000 (11:38 +0100)]
iterator: test pathlist handling for directories

tree_iterator was only working properly for a pathlist containing
file paths. In case of directory paths, it didn't match children
which contradicts GIT_DIFF_DISABLE_PATHSPEC_MATCH and
is different from index_iterator and fs_iterator.

As a consequence head-to-index status reporting for a specific
directory did not work properly -- all files have been reported
as added.

Include additional tests.

8 years agoiterator: test `advance_over` with a pathlist
Edward Thomson [Wed, 16 Mar 2016 21:14:36 +0000 (17:14 -0400)]
iterator: test `advance_over` with a pathlist

8 years agoiterator: add tests for advance_over
Edward Thomson [Wed, 16 Mar 2016 20:29:38 +0000 (16:29 -0400)]
iterator: add tests for advance_over

`git_iterator_advance_over` is a gnarly bit of code with no actual
tests.

8 years agoiterator: test workdir pathlist with deep paths
Edward Thomson [Wed, 16 Mar 2016 17:31:35 +0000 (13:31 -0400)]
iterator: test workdir pathlist with deep paths

In the workdir iterator we do some tricky things to step down into
directories to look for things that are in our pathlist.  Make sure
that we don't confuse between folders that we're definitely going to
return everything in and folders that we're only stepping down into
to keep looking for matches.

8 years agoiterator: workdir tests with submodules
Edward Thomson [Wed, 16 Mar 2016 16:15:55 +0000 (12:15 -0400)]
iterator: workdir tests with submodules

Ensure that when specifying start/end paths, or pathlists, that we
deal correctly with submodules.

8 years agoiterator: expand workdir tests with pathlist
Edward Thomson [Wed, 16 Mar 2016 15:45:44 +0000 (11:45 -0400)]
iterator: expand workdir tests with pathlist

Expand the workdir tests to validate the paths in case sensitive
and insensitive tests.

8 years agoiterator: test that we're at the end of iteration
Edward Thomson [Wed, 16 Mar 2016 14:17:20 +0000 (10:17 -0400)]
iterator: test that we're at the end of iteration

Ensure that we have hit the end of iteration; previously we tested
that we saw all the values that we expected to see.  We did not
then ensure that we were at the end of the iteration (and that there
were subsequently values in the iteration that we did *not* expect.)

8 years agoiterator: combine fs+workdir iterators more completely
Edward Thomson [Thu, 10 Mar 2016 05:04:26 +0000 (00:04 -0500)]
iterator: combine fs+workdir iterators more completely

Drop some of the layers of indirection between the workdir and the
filesystem iterators.  This makes the code a little bit easier to
follow, and reduces the number of unnecessary allocations a bit as
well.  (Prior to this, when we filter entries, we would allocate them,
filter them and then free them; now we do the filtering before
allocation.)

Also, rename `git_iterator_advance_over_with_status` to just
`git_iterator_advance_over`.  Mostly because it's a fucking long-ass
function name otherwise.

8 years agoiterator: test fs iterator w/ many nested empty dirs
Edward Thomson [Thu, 10 Mar 2016 17:54:33 +0000 (12:54 -0500)]
iterator: test fs iterator w/ many nested empty dirs

8 years agoiterator: skip unreadable directories in fs iterator
Edward Thomson [Thu, 10 Mar 2016 16:07:13 +0000 (11:07 -0500)]
iterator: skip unreadable directories in fs iterator

Do not abort iteration in the middle when encountering an unreadable
directory.  Instead, skip it, as if it didn't exist.

8 years agocheckout: provide internal func to compute target path
Edward Thomson [Fri, 11 Mar 2016 16:27:58 +0000 (11:27 -0500)]
checkout: provide internal func to compute target path

Many code paths in checkout need the final, full on-disk path of the
file they're writing.  (No surprise).  However, they all munge the
`data->path` buffer themselves to get there.  Provide a nice helper
method for them.

Plus, drop the use `git_iterator_current_workdir_path` which does the
same thing but different.  Checkout is the only caller of this silly
function, which lets us remove it.

8 years agoiterators: refactored tree iterator
Edward Thomson [Thu, 25 Feb 2016 21:05:18 +0000 (16:05 -0500)]
iterators: refactored tree iterator

Refactored the tree iterator to never recurse; simply process the
next entry in order in `advance`.  Additionally, reduce the number of
allocations and sorting as much as possible to provide a ~30% speedup
on case-sensitive iteration.  (The gains for case-insensitive iteration
are less majestic.)

8 years agorepo::iterator: don't go out of bounds
Edward Thomson [Wed, 2 Mar 2016 20:38:13 +0000 (15:38 -0500)]
repo::iterator: don't go out of bounds

8 years agogit_object_dup: introduce typesafe versions
Edward Thomson [Wed, 17 Feb 2016 18:04:19 +0000 (18:04 +0000)]
git_object_dup: introduce typesafe versions

8 years agoiterator: disambiguate reset and reset_range
Edward Thomson [Thu, 25 Feb 2016 20:11:14 +0000 (15:11 -0500)]
iterator: disambiguate reset and reset_range

Disambiguate the reset and reset_range functions.  Now reset_range
with a NULL path will clear the start or end; reset will leave the
existing start and end unchanged.

8 years agoiterator: drop unused/unimplemented `seek`
Edward Thomson [Thu, 25 Feb 2016 19:51:23 +0000 (14:51 -0500)]
iterator: drop unused/unimplemented `seek`

8 years agostatus: update test to include valid OID
Edward Thomson [Thu, 17 Mar 2016 04:47:50 +0000 (00:47 -0400)]
status: update test to include valid OID

8 years agoMerge pull request #3707 from sschuberth/master
Edward Thomson [Wed, 23 Mar 2016 20:14:04 +0000 (13:14 -0700)]
Merge pull request #3707 from sschuberth/master

CMakeLists: Show the pointer size for an unsupported architecture

8 years agoCMakeLists: Show the pointer size for an unsupported architecture
Sebastian Schuberth [Wed, 23 Mar 2016 19:37:39 +0000 (20:37 +0100)]
CMakeLists: Show the pointer size for an unsupported architecture

Showing the pointer size gives a hint as to why we think this is an
unsupported architecture.

8 years agoarray: fix search for empty arrays
Carlos Martín Nieto [Wed, 23 Mar 2016 15:51:52 +0000 (16:51 +0100)]
array: fix search for empty arrays

When the array is empty `cmp` never gets set by the comparison
function. Initialize it so we return ENOTFOUND in those cases.

8 years agoMerge pull request #3704 from ethomson/tree-reuse
Carlos Martín Nieto [Wed, 23 Mar 2016 10:45:53 +0000 (03:45 -0700)]
Merge pull request #3704 from ethomson/tree-reuse

tree: drop the now-unnecessary entries vector

8 years agoMerge pull request #3502 from libgit2/cmn/createblob-stream
Carlos Martín Nieto [Tue, 22 Mar 2016 21:34:35 +0000 (14:34 -0700)]
Merge pull request #3502 from libgit2/cmn/createblob-stream

Add ability to write a filtered blob through a stream

8 years agoblob: remove _fromchunks()
Carlos Martín Nieto [Sun, 8 Nov 2015 03:28:08 +0000 (04:28 +0100)]
blob: remove _fromchunks()

The callback mechanism makes it awkward to write data from an IO
source; move to `_fromstream()` which lets the caller remain in control,
in the same vein as we prefer iterators over foreach callbacks.

8 years agoCHANGELOG: add a note about _fromstream() and _fromstream_commit()
Carlos Martín Nieto [Wed, 4 Nov 2015 18:39:55 +0000 (10:39 -0800)]
CHANGELOG: add a note about _fromstream() and _fromstream_commit()

8 years agoblob: fix fromchunks iteration counter
Carlos Martín Nieto [Wed, 4 Nov 2015 18:36:50 +0000 (10:36 -0800)]
blob: fix fromchunks iteration counter

By returning when the count goes to zero rather than below it, setting
`howmany` to 7 in fact writes out the string 6 times.

Correct the termination condition to write out the string the amount of
times we specify.

8 years agoblob: introduce creating a blob by writing into a stream
Carlos Martín Nieto [Wed, 4 Nov 2015 18:30:48 +0000 (10:30 -0800)]
blob: introduce creating a blob by writing into a stream

The pair of `git_blob_create_frombuffer()` and
`git_blob_create_frombuffer_commit()` is meant to replace
`git_blob_create_fromchunks()` by providing a way for a user to write a
new blob when they want filtering or they do not know the size.

This approach allows the caller to retain control over when to add data
to this buffer and a more natural fit into higher-level language's own
stream abstractions instead of having to handle IO wait in the callback.

The in-memory buffer size of 2MB is chosen somewhat arbitrarily to be a
round multiple of usual page sizes and a value where most blobs seem
likely to be either going to be way below or way over that size. It's
also a round number of pages.

This implementation re-uses the helper we have from `_fromchunks()` so
we end up writing everything to disk, but hopefully more efficiently
than with a default filebuf. A later optimisation can be to avoid
writing the in-memory contents to disk, with some extra complexity.

8 years agofilebuf: allow using a custom buffer size
Carlos Martín Nieto [Wed, 4 Nov 2015 17:20:14 +0000 (09:20 -0800)]
filebuf: allow using a custom buffer size

Allow setting the buffer size on open in order to use this data
structure more generally as a spill buffer, with larger buffer sizes for
specific use-cases.

8 years agotree: drop the now-unnecessary entries vector
Edward Thomson [Tue, 22 Mar 2016 04:18:44 +0000 (00:18 -0400)]
tree: drop the now-unnecessary entries vector

Remove the now-unnecessary entries vector.  Add `git_array_search`
to binary search through an array to accomplish this.

8 years agoMerge pull request #3559 from yongthecoder/master
Carlos Martín Nieto [Tue, 22 Mar 2016 08:54:49 +0000 (01:54 -0700)]
Merge pull request #3559 from yongthecoder/master

Add a sanity check in git_indexer_commit to avoid subtraction overflow.

8 years agoMerge pull request #3701 from jfultz/fix-0.24.0-changelog
Carlos Martín Nieto [Tue, 22 Mar 2016 07:44:05 +0000 (00:44 -0700)]
Merge pull request #3701 from jfultz/fix-0.24.0-changelog

Fix some errors I found in the changelog for 0.24.0

8 years agoMerge pull request #3702 from libgit2/cmn/tree-reuse
Edward Thomson [Tue, 22 Mar 2016 04:29:33 +0000 (21:29 -0700)]
Merge pull request #3702 from libgit2/cmn/tree-reuse

Reuse a tree's buffer and allocate constant-sized entries in an array

8 years agoconfig: don't special-case multivars that don't exist yet
Carlos Martín Nieto [Mon, 21 Mar 2016 20:10:26 +0000 (21:10 +0100)]
config: don't special-case multivars that don't exist yet

This special-casing ignores that we might have a locked file, so the
hashtable does not represent the contents of the file we want to
write. This causes multivar writes to overwrite entries instead of add
to them when under lock.

There is no need for this as the normal code-path will write to the file
just fine, so simply get rid of it.

8 years agotree: store the entries in a growable array
Carlos Martín Nieto [Sun, 20 Mar 2016 11:01:45 +0000 (12:01 +0100)]
tree: store the entries in a growable array

Take advantage of the constant size of tree-owned arrays and store them
in an array instead of a pool. This still lets us free them all at once
but lets the system allocator do the work of fitting them in.

8 years agotree: re-use the id and filename in the odb object
Carlos Martín Nieto [Sun, 20 Mar 2016 10:00:12 +0000 (11:00 +0100)]
tree: re-use the id and filename in the odb object

Instead of copying over the data into the individual entries, point to
the originals, which are already in a format we can use.

8 years agoFix some errors I found in the changelog for 0.24.0
John Fultz [Fri, 18 Mar 2016 20:03:08 +0000 (15:03 -0500)]
Fix some errors I found in the changelog for 0.24.0

8 years agoMerge pull request #3699 from libgit2/cmn/win32-free-tls
Edward Thomson [Fri, 18 Mar 2016 13:37:41 +0000 (06:37 -0700)]
Merge pull request #3699 from libgit2/cmn/win32-free-tls

win32: free thread-local data on thread exit

8 years agowin32: free thread-local data on thread exit
Carlos Martin Nieto [Fri, 18 Mar 2016 20:00:27 +0000 (13:00 -0700)]
win32: free thread-local data on thread exit

8 years agoMerge pull request #3660 from mstrap/mingw
Edward Thomson [Fri, 18 Mar 2016 13:37:04 +0000 (06:37 -0700)]
Merge pull request #3660 from mstrap/mingw

MinGW builds should optionally create DLLs without "lib" prefix