Edward Thomson
1a79cd959b
patch: show copy information for identical copies
...
When showing copy information because we are duplicating contents,
for example, when performing a `diff --find-copies-harder -M100 -B100`,
then show copy from/to lines in a patch, and do not show context.
Ensure that we can also parse such patches.
2016-06-25 23:08:30 -04:00
Edward Thomson
9eb1938134
patch::parse: test diff with exact rename and copy
2016-06-25 23:08:30 -04:00
Edward Thomson
8a670dc4c0
patch::parse: test diff with simple rename
2016-06-25 23:08:28 -04:00
Edward Thomson
38a347ea5d
patch::parse: handle patches with no hunks
...
Patches may have no hunks when there's no modifications (for example,
in a rename). Handle them.
2016-06-25 23:08:06 -04:00
Edward Thomson
e774d5af76
diff::parse tests: test parsing a diff
...
Test that we can create a diff file, then parse the results and
that the two are identical in-memory.
2016-06-25 23:08:04 -04:00
Edward Thomson
853e585fb1
patch: zero id and abbrev length for empty files
2016-05-26 13:01:09 -05:00
Edward Thomson
33ae876239
patch: identify non-binary patches as NOT_BINARY
2016-05-26 13:01:09 -05:00
Edward Thomson
728274904f
Introduce git_diff_to_buf
...
Like `git_patch_to_buf`, provide a simple helper method that can
print an entire diff directory to a `git_buf`.
2016-05-26 13:01:09 -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
aa4bfb32b9
parse: introduce parse_ctx_contains_s
2016-05-26 13:01:08 -05:00
Edward Thomson
8d44f8b78f
patch: patch_diff
-> patch_generated
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
00e63b3620
patch: provide static string advance_expected
2016-05-26 13:01:07 -05:00
Edward Thomson
a03952f095
patch: formatting cleanups
2016-05-26 13:01:07 -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
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