Commit Graph

9561 Commits

Author SHA1 Message Date
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
0267c34c0c patch application: drop unnecessary patch_image_init 2016-05-26 13:01:07 -05:00
Edward Thomson
4117a2350f patch parse: dup the patch from the callers 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
f941f035ae patch: drop some warnings 2016-05-26 13:01:06 -05:00
Edward Thomson
040ec883a4 patch: use strlen to mean string length
`oid_strlen` has meant one more than the length of the string.
This is mighty confusing.  Make it mean only the string length!
Whomsoever needs to allocate a buffer to hold a string can null
terminate it like normal.
2016-05-26 13:01:06 -05:00
Edward Thomson
e2cdc145b9 patch: show modes when only the mode has changed 2016-05-26 13:01:06 -05:00
Edward Thomson
4ac2d8acf4 patch: quote filenames when necessary 2016-05-26 13:01:06 -05:00
Edward Thomson
d3d95d5ae2 git_buf_quote: quote ugly characters 2016-05-26 13:01:06 -05:00
Edward Thomson
72806f4cca patch: don't print some headers on pure renames 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
19e46645af patch printing: include rename information 2016-05-26 13:01:06 -05:00
Edward Thomson
d536ceacf5 patch_parse: don't set new mode when deleted 2016-05-26 13:01:05 -05:00
Edward Thomson
28f704433b patch_parse: use names from diff --git header
When a text file is added or deleted, use the file names from the
`diff --git` header instead of the `---` or `+++` lines.  This is
for compatibility with git.
2016-05-26 13:01:05 -05:00
Edward Thomson
1462c95a5d patch_parse: set binary flag
We may have parsed binary data, set the `SHOW_BINARY` flag which
indicates that we have actually computed a binary diff.
2016-05-26 13:01:05 -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
bc6a31c9fb patch: when parsing, set nfiles correctly in delta 2016-05-26 13:01:05 -05:00
Edward Thomson
d68cb73677 diff: include oid length in deltas
Now that `git_diff_delta` data can be produced by reading patch
file data, which may have an abbreviated oid, allow consumers to
know that the id is abbreviated.
2016-05-26 13:01:05 -05:00
Edward Thomson
e7ec327d4b patch parse: unset path prefix 2016-05-26 13:01:04 -05:00
Edward Thomson
8bca8b9e03 apply: move patch data to patch_common.h 2016-05-26 13:01:04 -05:00
Edward Thomson
b85bd8ce66 patch: use delta's old_file/new_file members
No need to replicate the old_file/new_file members, or plumb them
strangely up.
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
1cd6599142 delta: refactor git_delta functions for consistency
Refactor the git_delta functions to have consistent naming and
parameters with the rest of the library.
2016-05-26 13:01:03 -05:00
Edward Thomson
6a2d2f8aa1 delta: move delta application to delta.c
Move the delta application functions into `delta.c`, next to the
similar delta creation functions.  Make the `git__delta_apply`
functions adhere to other naming and parameter style within the
library.
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
784bb30300 Merge pull request #3799 from sschuberth/master
Use AppVeyor's Start-FileDownload cmdlet
2016-05-26 10:28:00 -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
Edward Thomson
06f42b6217 Merge branch 'checkout_submodules' 2016-05-26 01:20:41 -05:00
Jason Haslam
c864b4ab99 Ignore submodules when checking for merge conflicts in the workdir. 2016-05-26 01:11:55 -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
Edward Thomson
fdf14637d5 Merge pull request #3792 from edquist/misc
Fix comment for GIT_FILEMODE_LINK
2016-05-26 00:58:43 -05:00
Sebastian Schuberth
247665ed51 Use AppVeyor's Start-FileDownload cmdlet
Start-FileDownload maintains current directory context and allows
specifying a request timeout, see [1].

[1] https://www.appveyor.com/docs/how-to/download-file#start-filedownload-cmdlet
2016-05-25 12:10:44 +02: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
c756448cef Merge pull request #3797 from libgit2/cmn/remove-single-entry
tree: handle removal of all entries in the updater
2016-05-24 16:15:57 +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
c91a1dc1d9 Merge pull request #3794 from libgit2/cmn/tree-update-basename
Tree updater fixups
2016-05-23 18:02:24 +02:00
François Revol
d94f503729 CMakeLists: Add libnetwork for Haiku 2016-05-22 23:24:30 +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
6ee08d2cd0 tree: use the basename for the entry removal
When we want to remove the file, use the basename as the name of the
entry to remove, instead of the full one, which includes the directories
we've inserted into the stack.
2016-05-19 15:22:02 +02:00