Commit Graph

9678 Commits

Author SHA1 Message Date
Patrick Steinhardt
ec3f5a9c20 script: cibuild: build examples 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
fc29391950 examples: add: fix type casting warning 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
5c2a8361d7 examples: diff: parse correct types for line-diffopts 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
7314da1055 examples: fix warnings in network/fetch.c 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
e2d1b7ecbf examples: general: fix remaining warnings 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
662eee1541 examples: general: convert C99 comments to C90 comments 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
c313e3d986 examples: general: extract function demonstrating OID parsing 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
29d9afc0fb examples: general: extract function demonstrating ODB 2016-10-10 09:04:42 +02:00
Patrick Steinhardt
b009adad35 examples: general: extract function demonstrating commit writing 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
15960454c5 examples: general: extract functions demonstrating object parsing 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
8b93ccdf08 examples: general: extract function demonstrating revwalking 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
c079e3c847 examples: general: extract function demonstrating index walking 2016-10-10 09:04:41 +02:00
Patrick Steinhardt
f9a7973dd9 examples: general: extract function demonstrating reference listings 2016-10-10 09:04:41 +02:00
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
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
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
955c99c214 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.
2016-09-14 10:28:24 +01:00
Edward Thomson
89c332e41b Merge pull request #3929 from libgit2/vmg/time
time: Export `git_time_monotonic`
2016-09-13 16:16:20 +02:00
Vicent Marti
2749ff46d8 time: Export git_time_monotonic 2016-09-13 15:52:43 +02:00
Patrick Steinhardt
bba704adf7 Merge pull request #3925 from pks-t/pks/cmake-library-dirs
cmake: add curl library path
2016-09-09 08:45:33 +02:00
Edward Thomson
9ad07fc003 Merge pull request #3923 from libgit2/ethomson/diff-read-empty-binary
Read binary patches (with no binary data)
2016-09-06 10:43:21 -05:00
Patrick Steinhardt
46035d984f Merge pull request #3882 from pks-t/pks/fix-fetch-refspec-dst-parsing
refspec: do not set empty rhs for fetch refspecs
2016-09-06 11:21:29 +02:00