Commit Graph

1970 Commits

Author SHA1 Message Date
Edward Thomson
5acf18ac63 rebase: test rebasing a new commit with subfolder
Test a rebase (both a merge rebase and an inmemory rebase) with a new
commit that adds files underneath a new subfolder.
2016-06-02 02:38:18 -05:00
Edward Thomson
91fbf9d867 test: ensure we can round-trip a written tree
Read a tree into an index, write the index, then re-open the index and
ensure that we are treesame to the original.
2016-06-02 02:37:04 -05:00
Edward Thomson
5baa20b86e round-trip trees through index_read_index
Read a tree into an index using `git_index_read_index` (by reading
a tree into a new index, then reading that index into the current
index), then write the index back out, ensuring that our new index
is treesame to the tree that we read.
2016-06-02 00:59:46 -05:00
Edward Thomson
c2f18b9b06 cleanup: unused warning 2016-06-01 10:03:51 -05:00
Edward Thomson
7166bb1665 introduce git_diff_from_buffer to parse diffs
Parse diff files into a `git_diff` structure.
2016-05-26 13:01:09 -05:00
Edward Thomson
94e488a056 patch: differentiate not found and invalid patches 2016-05-26 13:01:08 -05:00
Edward Thomson
17572f67ed git_patch_parse_ctx: refcount the context 2016-05-26 13:01:08 -05:00
Edward Thomson
9be638ecf0 git_diff_generated: abstract generated diffs 2016-05-26 13:01:08 -05:00
Edward Thomson
53571f2f0c vector: more sensible names for grow_at/shrink_at 2016-05-26 13:01:08 -05:00
Edward Thomson
440e3bae10 patch: git_patch_from_patchfile -> git_patch_from_buffer 2016-05-26 13:01:08 -05:00
Edward Thomson
e564fc65b5 git_vector_grow/shrink: correct shrink, and tests 2016-05-26 13:01:07 -05:00
Edward Thomson
0ff723cc90 apply: test postimages that grow/shrink original
Test with some postimages that actually grow/shrink from the
original, adding new lines or removing them.  (Also do so without
context to ensure that we can add/remove from a non-zero part of
the line vector.)
2016-05-26 13:01:07 -05:00
Edward Thomson
8cb27223b8 git_buf_quote/unquote: handle > \177
Parse values up to and including `\377` (`0xff`) when unquoting.
Print octal values as an unsigned char when quoting, lest `printf`
think we're talking about negatives.
2016-05-26 13:01:07 -05:00
Edward Thomson
6278fbc5dd patch parsing: squash some memory leaks 2016-05-26 13:01:07 -05:00
Edward Thomson
d3d95d5ae2 git_buf_quote: quote ugly characters 2016-05-26 13:01:06 -05:00
Edward Thomson
82175084e1 Introduce git_patch_options, handle prefixes
Handle prefixes (in terms of number of path components) for patch
parsing.
2016-05-26 13:01:06 -05:00
Edward Thomson
2f3b922ff1 patch_parse: test roundtrip patch parsing -> print 2016-05-26 13:01:05 -05:00
Edward Thomson
42b3442823 patch_parse: ensure we can parse a patch 2016-05-26 13:01:05 -05:00
Edward Thomson
8bca8b9e03 apply: move patch data to patch_common.h 2016-05-26 13:01:04 -05:00
Edward Thomson
804d5fe9f5 patch: abstract patches into diff'ed and parsed
Patches can now come from a variety of sources - either internally
generated (from diffing two commits) or as the results of parsing
some external data.
2016-05-26 13:01:04 -05:00
Edward Thomson
8d2eef27ff patch parsing: ensure empty patches are illegal 2016-05-26 13:01:04 -05:00
Edward Thomson
5d17d72621 patch parsing: parse binary patch files 2016-05-26 13:01:04 -05:00
Edward Thomson
b8dc2fdb92 zstream: fail when asked to inflate garbage
When we are provided some input buffer (with a length) to inflate,
and it contains more data than simply the deflated data, fail.
zlib will helpfully tell us when it is done reading (via Z_STREAM_END),
so if there is data leftover in the input buffer, fail lest we
continually try to inflate it.
2016-05-26 13:01:04 -05:00
Edward Thomson
5b78dbdbf3 git_buf: decode base85 inputs 2016-05-26 13:01:04 -05:00
Edward Thomson
3149ff6f66 patch application: apply binary patches
Handle the application of binary patches.  Include tests that
produce a binary patch (an in-memory `git_patch` object),
then enusre that the patch applies correctly.
2016-05-26 13:01:03 -05:00
Edward Thomson
b88f1713d0 zstream: offer inflating, git_zstream_inflatebuf
Introduce `git_zstream_inflatebuf` for simple uses.
2016-05-26 13:01:03 -05:00
Edward Thomson
0004386f29 apply: handle empty patches
When a patch is empty, simply copy the source into the destination.
2016-05-26 11:36:11 -05:00
Edward Thomson
d34f68261e Patch parsing from patch files 2016-05-26 11:36:11 -05:00
Edward Thomson
7cb904ba44 Introduce git_apply_patch
The beginnings of patch application from an existing (diff-created)
git_patch object: applies the hunks of a git_patch to a buffer.
2016-05-26 11:36:11 -05:00
Edward Thomson
e102daa4f6 Merge pull request #3798 from mmuman/stat-test-fix
test: Fix stat() test to mask out unwanted bits
2016-05-26 10:25:40 -05:00
Jason Haslam
afab1fff01 checkout: handle dirty submodules correctly
Don't generate conflicts when checking out a modified submodule and the
submodule is dirty or modified in the workdir.
2016-05-26 01:11:34 -05:00
François Revol
407f2e9fbd test: Fix stat() test to mask out unwanted bits
Haiku and Hurd both pass extra bits in struct stat::st_mode.
2016-05-24 20:01:49 +02:00
Carlos Martín Nieto
a2cb47130e tree: handle removal of all entries in the updater
When we remove all entries in a tree, we should remove that tree from
its parent rather than include the empty tree.
2016-05-24 14:30:43 +02:00
Carlos Martín Nieto
5341230536 tree: plug leaks in the tree updater 2016-05-19 15:29:53 +02:00
Carlos Martín Nieto
922496562b tree: use testrepo2 for the tree updater tests
This gives us trees with subdirectories, which the new test needs.
2016-05-19 15:21:26 +02:00
Carlos Martín Nieto
9464f9ebc1 Introduce a function to create a tree based on a different one
Instead of going through the usual steps of reading a tree recursively
into an index, modifying it and writing it back out as a tree, introduce
a function to perform simple updates more efficiently.

`git_tree_create_updated` avoids reading trees which are not modified
and supports upsert and delete operations. It is not as versatile as
modifying the index, but it makes some common operations much more
efficient.
2016-05-17 17:41:05 +02:00
Carlos Martín Nieto
17a93afa78 Merge pull request #3757 from johnhaley81/jh/fix-create-initial-commit
Fix `git_commit_create` for an initial commit
2016-05-06 18:44:37 +02:00
John Haley
5785ae9b5e Fix initial commit test
`test_commit_commit__create_initial_commit_parent_not_current` was not correctly 
testing that `HEAD` was not changed. Now we grab the oid that it was pointing to
before the call to `git_commit_create` and the oid that it's pointing to afterwards
and compare those.
2016-05-04 11:15:56 -07:00
John Haley
4f22ccb979 Add tests for creating an initial commit 2016-05-03 13:32:32 -07:00
Edward Thomson
c7b4bbffcc rebase: test rebase (merge) w/ no common ancestor 2016-05-03 15:29:44 -04:00
Edward Thomson
d383c39b3b Introduce git_signature_from_buffer
Allow users to construct a signature from the type of signature
lines that actually appear in commits.
2016-04-28 12:47:14 -04:00
Edward Thomson
b3ffd8f638 rebase::abort: test we can abort rebase by revspec
Test that we can properly abort a rebase when it is initialized by a
revspec.  This ensures that we do not conflate revspecs and refnames.
2016-04-26 11:49:05 -04:00
Carlos Martín Nieto
9068704bd8 Merge pull request #3749 from arthurschreiber/arthur/add-git-reference-dup
Allow creating copies of `git_reference` objects.
2016-04-26 11:02:45 +02:00
Carlos Martín Nieto
c30955e0c0 Merge pull request #3748 from libgit2/ethomson/rebase_detached
Rebase improvements with IDs
2016-04-26 11:02:05 +02:00
Carlos Martín Nieto
eb39284bab tag: ignore extra header fields
While no extra header fields are defined for tags, git accepts them by
ignoring them and continuing the search for the message. There are a few
tags like this in the wild which git parses just fine, so we should do
the same.
2016-04-25 12:18:32 +02:00
Arthur Schreiber
908f24fd13 Allow creating copies of git_reference objects. 2016-04-22 10:34:17 -07:00
Edward Thomson
1f84caf0c0 rebase: correctly finish rebasing detached heads
When rebasing with IDs, we do not return to the `branch`,
we remain in a detached HEAD state.
2016-04-21 18:19:05 -04:00
Edward Thomson
320f53cd6c rebase: test abort immediately after init
Instead of `open`ing a rebase and `abort`ing that, test that we can
`abort` a rebase that has just begun with `init`.
2016-04-21 18:19:05 -04:00
Edward Thomson
0bd7740173 clone test: annotate unused vars 2016-04-21 11:05:21 -04:00
Edward Thomson
1dc449105b Merge pull request #3110 from libgit2/cmn/proxy-config
Proxy configuration
2016-04-19 19:48:52 -04:00
Carlos Martín Nieto
1c3018eb12 ignore: fix directory limits when searching for star-star
In order to match the star-star, we disable the flag that's looking for
a single path element, but that leads to searching for the pattern in
the middle of elements in the input string.

Mark when we're handing a star-star so we jump over the elements in our
attempt to match the part of the pattern that comes after the star-star.

While here, tighten up the check so we don't allow invalid rules
through.
2016-04-19 19:39:05 +02:00
Carlos Martín Nieto
0d72f67f28 proxy: don't specify the protocol in the type
We leave this up to the scheme in the url field. The type should only
tell us about whether we want a proxy and whether we want to auto-detect
it.
2016-04-19 13:54:19 +02:00
Carlos Martín Nieto
4e01741390 netops: make the path optional in URLs
When we're dealing with proxy addresses, we only want a hostname and
port, and the user would not provide a path, so make it optional so we
can use this same function to parse git as well as proxy URLs.
2016-04-19 13:54:19 +02:00
Carlos Martín Nieto
b117721dd8 proxy: use poxy to test our Windows proxy support 2016-04-19 13:54:19 +02:00
Carlos Martín Nieto
07bd3e57d9 proxy: ask the user for credentials if necessary 2016-04-19 13:54:19 +02:00
Antonio Scandurra
0f36271646 Add more tests for path matching with globs and path delimiters 2016-04-18 15:21:43 +02:00
Edward Thomson
bbd65ad27e 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.
2016-04-11 15:32:38 -04:00
Edward Thomson
0e00eecf83 Merge pull request #3736 from libgit2/cmn/dwim-general-message
refs: provide a more general error message for dwim
2016-04-11 13:29:54 -04:00
Edward Thomson
d22a8b9583 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.
2016-04-11 11:50:11 -04:00
Carlos Martín Nieto
6d22ef7a51 reset: use real ids for the tests
This lets us run with strict object creation on.
2016-04-11 11:47:56 -04:00
Carlos Martín Nieto
77965c685d 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.
2016-04-11 17:47:03 +02:00
Andreas Henriksson
04f47a43f9 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.
2016-04-06 15:00:32 +02:00
Carlos Martín Nieto
381caf5690 Merge pull request #3724 from ethomson/submodule_start_supports_silly_slashes
iterator/diff: allow trailing `/` on start/end paths to match submodules
2016-04-02 22:19:42 -07:00
Edward Thomson
d47f7e1c15 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.
2016-04-02 13:34:55 -07:00
Edward Thomson
2e0391f4f1 diff: test submodules are found with trailing /
Test that submodules are found when the are included in a pathspec
but have a trailing slash.
2016-04-02 13:02:41 -07:00
Carlos Martín Nieto
d364dc8b39 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.
2016-04-02 21:32:28 +02:00
Carlos Martín Nieto
1cac688d3f Merge pull request #3719 from libgit2/ethomson/submodule_status
WD iterator: properly identify submodules
2016-04-01 00:29:51 -07:00
Edward Thomson
74ab5f2cd0 status: test submodules with mixed case 2016-03-31 17:58:43 -04:00
Edward Thomson
17442b28f9 leaks: fix some leaks in the tests 2016-03-31 10:41:33 -04:00
Carlos Martín Nieto
f5c874a475 Plug a few leaks 2016-03-31 10:41:33 -04:00
Carlos Martín Nieto
2f0450f4d6 Merge pull request #3712 from ethomson/config_duplicate_section
config: don't write duplicate section
2016-03-29 03:26:43 -07:00
Edward Thomson
b085ecbe09 Merge pull request #3703 from libgit2/cmn/multivar-set-locked
config: don't special-case multivars that don't exist yet
2016-03-28 13:51:21 -04:00
Edward Thomson
76e1a679ea config::write::repeated: init our buffer 2016-03-28 08:56:13 -07:00
Carlos Martín Nieto
3e95bd36d9 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.
2016-03-28 10:47:14 -04:00
Marc Strapetz
c017c18361 iterator: new workdir-iterator test for pathlist + includings trees 2016-03-24 15:59:49 -04:00
Marc Strapetz
09064f15c5 iterator: new index-iterator test for pathlist + includings trees 2016-03-24 15:59:49 -04:00
Marc Strapetz
8152a74821 iterator: more pathlist-related tests should test actual paths 2016-03-24 15:59:49 -04:00
Edward Thomson
d712c2b27f iterator: don't run the gunk test by default on CI
(It's slow!)
2016-03-24 15:59:48 -04:00
Edward Thomson
0ef0b71ca5 iterator: refactor index iterator 2016-03-24 15:59:48 -04:00
Edward Thomson
ba6f86eb2e Introduce git_path_common_dirlen 2016-03-24 15:59:48 -04:00
Edward Thomson
de034cd239 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.
2016-03-24 15:59:48 -04:00
Jeff Hostetler
df25daef9b Added clar test for #3568 2016-03-23 17:17:02 -04:00
Edward Thomson
6cd9573f54 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.
2016-03-23 17:17:02 -04:00
joshaber
b620426006 Failing test. 2016-03-23 17:17:02 -04:00
Marc Strapetz
ae86aa5a68 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.
2016-03-23 17:16:38 -04:00
Edward Thomson
6bcddf88b3 iterator: test advance_over with a pathlist 2016-03-23 17:16:38 -04:00
Edward Thomson
9fb2527f3c iterator: add tests for advance_over
`git_iterator_advance_over` is a gnarly bit of code with no actual
tests.
2016-03-23 17:16:37 -04:00
Edward Thomson
85541f4390 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.
2016-03-23 17:16:37 -04:00
Edward Thomson
908d8de8c3 iterator: workdir tests with submodules
Ensure that when specifying start/end paths, or pathlists, that we
deal correctly with submodules.
2016-03-23 17:16:37 -04:00
Edward Thomson
c3d195f1d9 iterator: expand workdir tests with pathlist
Expand the workdir tests to validate the paths in case sensitive
and insensitive tests.
2016-03-23 17:16:37 -04:00
Edward Thomson
4c88198a85 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.)
2016-03-23 17:16:37 -04:00
Edward Thomson
d051de243c iterator: test fs iterator w/ many nested empty dirs 2016-03-23 17:08:37 -04:00
Edward Thomson
a4f520a6f6 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.
2016-03-23 17:08:37 -04:00
Edward Thomson
be30387e8b 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.)
2016-03-23 17:08:37 -04:00
Edward Thomson
277c85eb1c repo::iterator: don't go out of bounds 2016-03-23 17:08:37 -04:00
Edward Thomson
684b35c41b 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.
2016-03-23 17:08:37 -04:00
Edward Thomson
8a5a2e2f0e status: update test to include valid OID 2016-03-23 17:08:36 -04:00
Carlos Martín Nieto
661db4f482 Merge pull request #3704 from ethomson/tree-reuse
tree: drop the now-unnecessary entries vector
2016-03-23 03:45:53 -07:00
Carlos Martín Nieto
6669e3e839 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.
2016-03-22 20:00:25 +01:00
Carlos Martín Nieto
35e68606da 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.
2016-03-22 20:00:24 +01:00
Carlos Martín Nieto
0a5c602889 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.
2016-03-22 19:34:08 +01:00
Edward Thomson
e2e4bae9a0 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.
2016-03-22 06:21:13 -07:00
Carlos Martín Nieto
6f09911c0f 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.
2016-03-21 22:25:12 +01:00
Carlos Martín Nieto
60a194aa86 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.
2016-03-20 11:00:12 +01:00
Edward Thomson
d953c4505e merge drivers: handle configured but not found driver 2016-03-17 11:06:00 -04:00
Edward Thomson
6d8b2cdbee merge driver: remove check callback
Since the `apply` callback can defer, the `check` callback is not
necessary.  Removing the `check` callback further makes the `payload`
unnecessary along with the `cleanup` callback.
2016-03-17 11:06:00 -04:00
Edward Thomson
58d33126d4 merge driver: tests for set and unset merge attribute
Ensure that setting the merge attribute forces the built-in default
`text` driver and does *not* honor the `merge.default` configuration
option.  Further ensure that unsetting the merge attribute forces
a conflict (the `binary` driver).
2016-03-17 11:02:27 -04:00
Edward Thomson
d3f0875a60 merge driver: tests for custom default merge drivers 2016-03-17 11:02:27 -04:00
Edward Thomson
7d307c1edc merge driver: test GIT_EMERGECONFLICT
When a `check` or `apply` callback function returns `GIT_EMERGECONFLICT`
stop and product a conflict.
2016-03-17 11:02:27 -04:00
Edward Thomson
59f2931465 merge driver: test GIT_PASSTHROUGH
When a `check` or `apply` callback function returns `GIT_PASSTHROUGH`,
move on to the default merge driver.
2016-03-17 11:02:27 -04:00
Edward Thomson
3f04219fcd merge driver: introduce custom merge drivers
Consumers can now register custom merged drivers with
`git_merge_driver_register`.  This allows consumers to support the
merge drivers, as configured in `.gitattributes`.  Consumers will be
asked to perform the file-level merge when a custom driver is
configured.
2016-03-17 11:02:26 -04:00
Stan Hu
7a74590d8f Fix rebase bug and include test for merge=union 2016-03-17 11:02:26 -04:00
Edward Thomson
ba3493228c Merge pull request #3673 from libgit2/cmn/commit-with-signature
commit: add function to attach a signature to a commit
2016-03-17 06:57:56 -07:00
Edward Thomson
a151eb544b Merge pull request #3685 from pks-t/pks/memleaks
Test memleaks
2016-03-17 06:55:24 -07:00
Carlos Martín Nieto
bf804d407e commit: fix extraction of single-line signatures
The function to extract signatures suffers from a similar bug to the
header field finding one by having an unecessary line feed check as a
break condition of its loop.

Fix that and add a test for this single-line signature situation.
2016-03-17 10:48:06 +01:00
Carlos Martín Nieto
02d61a3b66 commit: add function to attach a signature to a commit
In combination with the function which creates a commit into a buffer,
this allows us to more easily create signed commits.
2016-03-15 12:55:03 +01:00
Dirkjan Bussink
c577efbbb5 Use general cl_git_fail because the error is generic 2016-03-14 12:41:41 +00:00
Dirkjan Bussink
fa72d6daf8 Setup better defaults for OpenSSL ciphers
This ensures that when using OpenSSL a safe default set of ciphers
is selected. This is done so that the client communicates securely
and we don't accidentally enable unsafe ciphers like RC4, or even
worse some old export ciphers.

Implements the first part of https://github.com/libgit2/libgit2/issues/3682
2016-03-14 12:07:13 +00:00
Patrick Steinhardt
35b7bca28b tests: transport: fix memory leaks with registering transports 2016-03-11 11:06:42 +01:00
Patrick Steinhardt
e756877dbf tests: nsec: correctly free nsec_path
git_buf_clear does not free allocated memory associated with a
git_buf. Use `git_buf_free` instead to correctly free its memory
and plug the memory leak.
2016-03-11 09:07:42 +01:00
Carlos Martín Nieto
2ba9a0ddac Merge pull request #3623 from ethomson/rebase_with_commit
rebase: additional setup tests of exotic behavior
2016-03-09 23:45:33 +01:00
Vicent Marti
9a78665005 odb: Handle corner cases in git_odb_expand_ids
The old implementation had two issues:

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

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

Skip the test if the user wants to insert a submodule.
2016-03-04 12:38:28 +01:00
Carlos Martín Nieto
e23efa6ddf tests: take the version from our define 2016-03-03 21:03:10 +01:00
Carlos Martín Nieto
9b3fc895b7 tests: plug a leak 2016-03-03 11:17:36 +01:00
Edward Thomson
09d9968014 rebase: additional tests for completing a rebase 2016-02-28 20:10:44 -05:00
Edward Thomson
f2dddf52c0 turn on strict object validation by default 2016-02-28 18:59:43 -05:00
Edward Thomson
4afe536ba1 tests: use legitimate object ids
Use legitimate (existing) object IDs in tests so that we have the
ability to turn on strict object validation when running tests.
2016-02-28 18:54:56 -05:00
Edward Thomson
98c341496f refs: honor strict object creation 2016-02-28 18:54:39 -05:00
Edward Thomson
6ddf533afc git_index_add: validate objects in index entries (optionally)
When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the index entries given to `git_index_add`.
2016-02-28 18:54:39 -05:00
Edward Thomson
2bbc7d3e56 treebuilder: validate tree entries (optionally)
When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the tree and parent ids given to treebuilder insertion.
2016-02-28 12:38:40 -05:00
Edward Thomson
ef63bab306 git_commit: validate tree and parent ids
When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the tree and parent ids given to commit creation functions.
2016-02-28 12:38:39 -05:00
Edward Thomson
6cc4bac894 Merge pull request #3577 from rossdylan/rossdylan/pooldebug
Add a new build flag to disable the pool allocator
2016-02-28 11:31:10 -05:00
Edward Thomson
a4c55069e3 nsec: update staging test for GIT_USE_NSECS
The index::nsec::staging_maintains_other_nanos test was created to
ensure that when we stage an entry when GIT_USE_NSECS is *unset* that
we truncate the index entry and do not persist the (old, invalid)
nanosec values.  Ensure that when GIT_USE_NSECS is *set* that we do
not do that, and actually write the correct nanosecond values.
2016-02-25 11:40:40 -05:00
Edward Thomson
7bab2e8fbf git_libgit2_opts: validate key 2016-02-22 23:07:30 -05:00
Carlos Martín Nieto
5663d4f691 Merge pull request #3613 from ethomson/fixups
Remove most of the silly warnings
2016-02-18 12:31:56 +01:00
Carlos Martín Nieto
594a5d12d4 Merge pull request #3619 from ethomson/win32_forbidden
win32: allow us to read indexes with forbidden paths on win32
2016-02-18 12:28:06 +01:00
Edward Thomson
2a39818c37 rebase: additional setup tests of exotic behavior
Test some additional exotic rebase setup behavior:  that we are
able to set up properly when already in a detached HEAD state,
that the caller specifies all of branch, upstream and onto,
and that the caller specifies branch, upstream and onto by ID.
2016-02-17 16:22:15 +00:00
Edward Thomson
318b825e76 index: allow read of index w/ illegal entries
Allow `git_index_read` to handle reading existing indexes with
illegal entries.  Allow the low-level `git_index_add` to add
properly formed `git_index_entry`s even if they contain paths
that would be illegal for the current filesystem (eg, `AUX`).
Continue to disallow `git_index_add_bypath` from adding entries
that are illegal universally illegal (eg, `.git`, `foo/../bar`).
2016-02-17 13:10:33 +00:00