Commit Graph

10689 Commits

Author SHA1 Message Date
Patrick Steinhardt
986913f45b examples: general: extract function demonstrating config files 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
176d58bad4 examples: general: use tabs instead of spaces 2016-10-10 09:04:41 +02:00
Josh Leeb-du Toit
ba3a8304ab Remove set of submodule update checkout_strategy
Remove overriding the `checkout_strategy` for `update_options` when
performing an update on a submodule. Users should be specifying the
correct checkout strategy in
`update_options.checkout_opts.checkout_strategy`.
2016-10-10 09:50:24 +11:00
Josh Leeb-du Toit
3e22bb71f2 Update submodule update opts init as per code review
Update the `GIT_SUBMODULE_UPDATE_OPTIONS_INIT` definition with the
correct values after removing `clone_checkout_strategy` in
`git_submodule_update_options`.
2016-10-10 09:50:24 +11:00
Josh Leeb-du Toit
dc976e72e9 Reword CHANGELOG entry as per code review 2016-10-10 09:50:24 +11:00
Josh Leeb-du Toit
567fd782d9 Remove clone_checkout_strategy in submodule update opts
Remove `clone_checkout_strategy` in `git_submodule_update_options` as
per issue #3784.
2016-10-10 09:50:24 +11:00
Edward Thomson
610cff13a3 Merge branch 'pr/3809' 2016-10-09 16:05:48 +01:00
Sim Domingo
dc5cfdbab9 make git_diff_stats_to_buf not show 0 insertions or 0 deletions 2016-10-09 16:03:00 +01:00
Edward Thomson
2468bf0615 Merge pull request #3958 from libgit2/ethomson/settings_docs
docs: GIT_OPT_ENABLE_STRICT_OBJECT_CREATION is enabled
2016-10-09 15:45:20 +01:00
Edward Thomson
aae8953496 Merge pull request #3956 from pks-t/pks/object-parsing-hardening
Object parsing hardening
2016-10-09 12:51:48 +01:00
Patrick Steinhardt
a719ef5e6d commit: always initialize commit message
When parsing a commit, we will treat all bytes left after parsing
the headers as the commit message. When no bytes are left, we
leave the commit's message uninitialized. While uncommon to have
a commit without message, this is the right behavior as Git
unfortunately allows for empty commit messages.

Given that this scenario is so uncommon, most programs acting on
the commit message will never check if the message is actually
set, which may lead to errors. To work around the error and not
lay the burden of checking for empty commit messages to the
developer, initialize the commit message with an empty string
when no commit message is given.
2016-10-09 13:26:21 +02:00
Edward Thomson
93392cdd91 docs: GIT_OPT_ENABLE_STRICT_OBJECT_CREATION is enabled
We changed the defaults on strict object creation - it is enabled by
default.  Update the documentation to reflect that.
2016-10-09 11:27:56 +01:00
Carlos Martín Nieto
a7df4a9151 Merge pull request #3955 from arthurschreiber/arthur/fix-regcomp_l-check
Fix the existence check for `regcomp_l`.
2016-10-07 22:36:21 +02:00
Arthur Schreiber
361179786d Fix the existence check for regcomp_l.
`xlocale.h` only defines `regcomp_l` if `regex.h` was included as well.

Also change the test cases to actually test `p_regcomp` works with
a multibyte locale.
2016-10-07 12:47:04 -07:00
Edward Thomson
45dc219f65 Merge pull request #3921 from libgit2/cmn/walk-limit-enough
Improve revision walk preparation logic
2016-10-07 16:01:28 +01:00
Patrick Steinhardt
4974e3a596 tree: validate filename and OID length when parsing object
When parsing tree entries from raw object data, we do not verify
that the tree entry actually has a filename as well as a valid
object ID. Fix this by asserting that the filename length is
non-zero as well as asserting that there are at least
`GIT_OID_RAWSZ` bytes left when parsing the OID.
2016-10-07 09:18:55 +02:00
Carlos Martín Nieto
fedc05c89c revwalk: don't show commits that become uninteresting after being enqueued
When we read from the list which `limit_list()` gives us, we need to check that
the commit is still interesting, as it might have become uninteresting after it
was added to the list.
2016-10-06 18:13:34 +02:00
Carlos Martín Nieto
d11fcf867b Merge pull request #3953 from arthurschreiber/arthur/fix-regcomp-locale-issues
Make sure we use the `C` locale for `regcomp` on macOS.
2016-10-06 14:57:11 +02:00
Arthur Schreiber
ab96ca5572 Make sure we use the C locale for regcomp on macOS. 2016-10-06 13:15:31 +02:00
Carlos Martín Nieto
3cc5ec94f8 rebase: don't ask for time sorting
`git-rebase--merge` does not ask for time sorting, but uses the default. We now
produce the same default time-ordered output as git, so make us of that since
it's not always the same output as our time sorting.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
82d4c0e6b8 revwalk: update the description for the default sorting
It changed from implementation-defined to git's default sorting, as there are
systems (e.g. rebase) which depend on this order. Also specify more explicitly
how you can get git's "date-order".
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
ea1ceb7f55 revwalk: remove a useless enqueueing phase for topological and default sorting
After `limit_list()` we already have the list in time-sorted order, which is
what we want in the "default" case. Enqueueing into the "unsorted" list would
just reverse it, and the topological sort will do its own sorting if it needs
to.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
4aed1b9a69 Add revwalk note to CHANGELOG 2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
9db367bf27 revwalk: get rid of obsolete marking code
We've now moved to code that's closer to git and produces the output
during the preparation phase, so we no longer process the commits as
part of generating the output.

This makes a chunk of code redundant, as we're simply short-circuiting
it by detecting we've processed the commits alrady.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
e93b7e327a revwalk: style change
Change the condition for returning 0 more in line with that we write
elsewhere in the library.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
5e2a29a78c commit_list: fix the date comparison function
This returns the integer-cast truth value comparing the dates. What we
want instead of a (-1, 0, 1) output depending on how they compare.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
48c64362e4 revwalk: port over the topological sorting
After porting over the commit hiding and selection we were still left
with mistmaching output due to the topologial sort.

This ports the topological sorting code to make us match with our
equivalent of `--date-order` and `--topo-order` against the output
from `rev-list`.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
938f8e32ec pqueue: support not having a comparison function
In this case, we simply behave like a vector.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
0bd43371c2 vector, pqueue: add git_vector_reverse and git_pqueue_reverse
This is a convenience function to reverse the contents of a vector and a pqueue
in-place.

The pqueue function is useful in the case where we're treating it as a
LIFO queue.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
6708618c10 revwalk: get closer to git
We had some home-grown logic to figure out which objects to show during
the revision walk, but it was rather inefficient, looking over the same
list multiple times to figure out when we had run out of interesting
commits. We now use the lists in a smarter way.

We also introduce the slop mechanism to determine when to stpo
looking. When we run out of interesting objects, we continue preparing
the walk for another 5 rounds in order to make it less likely that we
miss objects in situations with complex graphs.
2016-10-06 11:04:55 +02:00
Edward Thomson
565fb8dcd4 revwalk: introduce tests that hide old commits
Introduce some tests that show some commits, while hiding some commits
that have a timestamp older than the common ancestors of these two
commits.
2016-10-06 11:04:55 +02:00
Carlos Martín Nieto
e8ab13b3fd Merge pull request #3954 from libgit2/cmn/osx-ssh-key
Travis Mac SSH key issues
2016-10-05 23:46:02 +02:00
Carlos Martín Nieto
db357667bc 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.
2016-10-05 20:23:58 +02:00
Carlos Martín Nieto
94d565b957 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.
2016-10-05 18:52:43 +02:00
Carlos Martín Nieto
8e268168ec Bump version to 0.24.2 2016-10-02 13:20:35 +02:00
Edward Thomson
9fbbb0eec5 Merge pull request #3931 from libgit2/ethomson/checkout_dont_calculate_oid_for_dirs
checkout: don't try to calculate oid for directories
2016-10-01 19:32:16 -05:00
Edward Thomson
58a2a8fa2b Merge pull request #3949 from libgit2/ethomson/v24-updates
Some CI fixes for the maint/v0.24 branch
2016-10-01 19:29:55 -05:00
Edward Thomson
0c7e546fa7 ci: install homebrew's curl on mac 2016-10-01 19:01:39 -05:00
Edward Thomson
1db5e0276f ci: install homebrew's zlib on mac 2016-10-01 19:01:39 -05:00
Edward Thomson
e9f10cdad1 Merge pull request #3948 from libgit2/cmn/v24-updates
Backport fixes to v0.24
2016-10-01 19:00:49 -05:00
Carlos Martín Nieto
adfece0df2 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.
2016-10-01 17:41:29 +02:00
Edward Thomson
5a9d850e76 odb: only provide the empty tree
Only provide the empty tree internally, which matches git's behavior.
If we provide the empty blob then any users trying to write it with
libgit2 would omit it from actually landing in the odb, which appear
to git proper as a broken repository (missing that object).
2016-10-01 17:41:29 +02:00
Edward Thomson
ed5299ac20 odb: actually insert the empty blob in tests 2016-10-01 17:41:28 +02:00
Edward Thomson
886bd6a617 mwindow: init mwindow files in git_libgit2_init 2016-10-01 17:41:28 +02:00
Patrick Steinhardt
edf420f37b 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.
2016-10-01 17:41:28 +02:00
Stefan Huber
e499b13cb0 git_checkout_tree options fix
According to the reference the git_checkout_tree and git_checkout_head
functions should accept NULL in the opts field

This was broken since the opts field was dereferenced and thus lead to a
crash.
2016-10-01 17:41:28 +02:00
Patrick Steinhardt
12b73ff380 transports: http: reset connected flag when re-connecting transport
When calling `http_connect` on a subtransport whose stream is already
connected, we first close the stream in case no keep-alive is in use.
When doing so, we do not reset the transport's connection state,
though. Usually, this will do no harm in case the subsequent connect
will succeed. But when the connection fails we are left with a
substransport which is tagged as connected but which has no valid
stream attached.

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

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

   foo/bar
   !foo/bar

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

   foo/bar
   !bar

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

   bar
   !foo/bar

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

    foo/fruz_bar
    !bar

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

Both issues are fixed with this commit.
2016-10-01 17:41:28 +02:00
Patrick Steinhardt
8f342c6d6b stransport: do not use git_stream_free on uninitialized stransport
When failing to initialize a new stransport stream, we try to
release already allocated memory by calling out to
`git_stream_free`, which in turn called out to the stream's
`free` function pointer. As we only initialize the function
pointer later on, this leads to a `NULL` pointer exception.

Furthermore, plug another memory leak when failing to create the
SSL context.
2016-10-01 17:41:27 +02:00
Patrick Steinhardt
9aee7bc249 stransport: make internal functions static 2016-10-01 17:41:25 +02:00