|
0c7f49dd
|
2017-06-30T13:39:01
|
|
Make sure to always include "common.h" first
Next to including several files, our "common.h" header also declares
various macros which are then used throughout the project. As such, we
have to make sure to always include this file first in all
implementation files. Otherwise, we might encounter problems or even
silent behavioural differences due to macros or defines not being
defined as they should be. So in fact, our header and implementation
files should make sure to always include "common.h" first.
This commit does so by establishing a common include pattern. Header
files inside of "src" will now always include "common.h" as its first
other file, separated by a newline from all the other includes to make
it stand out as special. There are two cases for the implementation
files. If they do have a matching header file, they will always include
this one first, leading to "common.h" being transitively included as
first file. If they do not have a matching header file, they instead
include "common.h" as first file themselves.
This fixes the outlined problems and will become our standard practice
for header and source files inside of the "src/" from now on.
|
|
723bdf48
|
2017-03-20T09:35:23
|
|
patch_parse: check if advancing over header newline succeeds
While parsing patch header lines, we iterate over each line and check if
the line has trailing garbage. What we do not check though is that the
line is actually a line ending with a trailing newline.
Fix this by checking the return code of `parse_advance_expected_str`.
|
|
ad5a909c
|
2017-03-14T09:39:37
|
|
patch_parse: fix parsing minimal trailing diff line
In a diff, the shortest possible hunk with a modification (that is, no
deletion) results from a file with only one line with a single character
which is removed. Thus the following hunk
@@ -1 +1 @@
-a
+
is the shortest valid hunk modifying a line. The function parsing the
hunk body though assumes that there must always be at least 4 bytes
present to make up a valid hunk, which is obviously wrong in this case.
The absolute minimum number of bytes required for a modification is
actually 2 bytes, that is the "+" and the following newline. Note: if
there is no trailing newline, the assumption will not be offended as the
diff will have a line "\ No trailing newline" at its end.
This patch fixes the issue by lowering the amount of bytes required.
|
|
613381fc
|
2016-11-15T13:33:05
|
|
patch_parse: fix memory leak
|
|
c77a55a9
|
2016-11-14T10:05:31
|
|
common: use PRIuZ for size_t in `giterr_set` calls
|
|
adedac5a
|
2016-09-02T02:03:45
|
|
diff: treat binary patches with no data special
When creating and printing diffs, deal with binary deltas that have
binary data specially, versus diffs that have a binary file but lack the
actual binary data.
|
|
b859faa6
|
2016-08-23T23:38:39
|
|
Teach `git_patch_from_diff` about parsed diffs
Ensure that `git_patch_from_diff` can return the patch for parsed diffs,
not just generate a patch for a generated diff.
|
|
002c8e29
|
2016-08-03T17:09:41
|
|
git_diff_file: move `id_abbrev`
Move `id_abbrev` to a more reasonable place where it packs more nicely
(before anybody starts using it).
|
|
c065f6a1
|
2016-07-14T23:04:47
|
|
apply: check allocation properly
|
|
1a79cd95
|
2016-04-26T01:18:01
|
|
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.
|
|
38a347ea
|
2016-04-25T17:52:39
|
|
patch::parse: handle patches with no hunks
Patches may have no hunks when there's no modifications (for example,
in a rename). Handle them.
|
|
853e585f
|
2016-04-25T16:32:30
|
|
patch: zero id and abbrev length for empty files
|
|
33ae8762
|
2016-04-25T13:07:18
|
|
patch: identify non-binary patches as `NOT_BINARY`
|
|
7166bb16
|
2016-04-25T00:35:48
|
|
introduce `git_diff_from_buffer` to parse diffs
Parse diff files into a `git_diff` structure.
|
|
440e3bae
|
2015-11-21T12:27:03
|
|
patch: `git_patch_from_patchfile` -> `git_patch_from_buffer`
|
|
94e488a0
|
2016-04-24T16:14:25
|
|
patch: differentiate not found and invalid patches
|
|
17572f67
|
2016-04-21T00:04:14
|
|
git_patch_parse_ctx: refcount the context
|
|
aa4bfb32
|
2016-02-07T15:08:16
|
|
parse: introduce parse_ctx_contains_s
|
|
00e63b36
|
2015-11-21T12:37:01
|
|
patch: provide static string `advance_expected`
|
|
4117a235
|
2015-09-24T10:32:15
|
|
patch parse: dup the patch from the callers
|
|
6278fbc5
|
2015-09-24T09:40:42
|
|
patch parsing: squash some memory leaks
|
|
f941f035
|
2015-09-24T09:25:10
|
|
patch: drop some warnings
|
|
82175084
|
2015-09-23T13:40:12
|
|
Introduce git_patch_options, handle prefixes
Handle prefixes (in terms of number of path components) for patch
parsing.
|
|
19e46645
|
2015-09-23T11:07:04
|
|
patch printing: include rename information
|
|
d536ceac
|
2015-09-23T10:47:34
|
|
patch_parse: don't set new mode when deleted
|
|
28f70443
|
2015-09-23T10:38:51
|
|
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.
|
|
1462c95a
|
2015-09-23T09:54:25
|
|
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.
|
|
bc6a31c9
|
2015-09-22T18:29:14
|
|
patch: when parsing, set nfiles correctly in delta
|
|
d68cb736
|
2015-09-22T18:25:03
|
|
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.
|
|
e7ec327d
|
2015-09-22T17:56:42
|
|
patch parse: unset path prefix
|
|
b85bd8ce
|
2015-09-16T11:37:03
|
|
patch: use delta's old_file/new_file members
No need to replicate the old_file/new_file members, or plumb them
strangely up.
|
|
804d5fe9
|
2015-09-11T08:37:12
|
|
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.
|