| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ`
need to indicate that they're the size of _SHA1_ OIDs.
|
|
|
|
|
|
|
|
| |
When we know the file size (because we're producing it from a working
directory iterator, or an index with an up-to-date cache) then set a
flag indicating as such. This removes the ambiguity about a 0 file
size, which could indicate that a file exists and is 0 bytes, or that we
haven't read it yet.
|
|\
| |
| | |
Improve documentation
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
|
| |
`GIT_DIFF_IGNORE_BLANK_LINES` needs to be within a (signed) int, per the
`enum` definition of ISO C.
|
|
|
|
| |
`git_diff_format_email` is deprecated in favor of `git_email_create`.
|
| |
|
| |
|
|
|
|
|
| |
This just fixes a typo in the documentation, actual rename change was
done in 5f69a31f
|
|\
| |
| | |
diff: complete support for git patchid
|
| |
| |
| |
| |
| |
| |
| | |
Git is generating patch-id using a stripped down version of a patch
where hunk header and index information are not present.
Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
|
|/
|
|
|
| |
Instead of using a signed type (`off_t`) use a new `git_object_size_t`
for the sizes of objects.
|
|
|
|
|
|
| |
Using an `enum` causes trouble when used with C++ as bitwise operations are not possible w/o casting (e.g., `opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;` is invalid as there is no `&=` operator for `enum`).
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In libgit2 nomenclature, when we need to verb a direct object, we name
a function `git_directobject_verb`. Thus, if we need to init an options
structure named `git_foo_options`, then the name of the function that
does that should be `git_foo_options_init`.
The previous names of `git_foo_init_options` is close - it _sounds_ as
if it's initializing the options of a `foo`, but in fact
`git_foo_options` is its own noun that should be respected.
Deprecate the old names; they'll now call directly to the new ones.
|
|
|
|
|
|
|
|
|
| |
Since we now always build the library with cdecl calling conventions,
our callbacks should be decorated as such so that users will not be able
to provide callbacks defined with other calling conventions.
The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as
appropriate.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The C89 standard states in §6.7.2.2 "Enumeration specifiers":
> The expression that defines the value of an enumeration constant shall
> be an integer constant expression that has a value representable as an
> int.
On most platforms, this effectively limits the range to a 32 bit signed
integer. The enum `git_diff_option_t` though recently gained an entry
`GIT_DIFF_INDENT_HEURISTIC = (1u << 31)`, which breaks this limit.
Fix the issue by using a gap in `git_diff_option_t`'s enum values. While
this has the benefit of retaining our API, it may break applications
which do not get recompiled after upgrading libgit2. But as we are
bumping the soversion on each release anyway and thus force a recompile
of dependents, this is not a problem.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
We default to off, but we might want to consider changing `GIT_DIFF_NORMAL` to
include it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The upstream git project provides the ability to calculate a so-called
patch ID. Quoting from git-patch-id(1):
A "patch ID" is nothing but a sum of SHA-1 of the file diffs
associated with a patch, with whitespace and line numbers ignored."
Patch IDs can be used to identify two patches which are probably the
same thing, e.g. when a patch has been cherry-picked to another branch.
This commit implements a new function `git_diff_patchid`, which gets a
patch and derives an OID from the diff. Note the different terminology
here: a patch in libgit2 are the differences in a single file and a diff
can contain multiple patches for different files. The implementation
matches the upstream implementation and should derive the same OID for
the same diff. In fact, some code has been directly derived from the
upstream implementation.
The upstream implementation has two different modes to calculate patch
IDs, which is the stable and unstable mode. The old way of calculating
the patch IDs was unstable in a sense that a different ordering the
diffs was leading to different results. This oversight was fixed in git
1.9, but as git tries hard to never break existing workflows, the old
and unstable way is still default. The newer and stable way does not
care for ordering of the diff hunks, and in fact it is the mode that
should probably be used today. So right now, we only implement the
stable way of generating the patch ID.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Move `id_abbrev` to a more reasonable place where it packs more nicely
(before anybody starts using it).
|
|
|
|
|
| |
Like `git_patch_to_buf`, provide a simple helper method that can
print an entire diff directory to a `git_buf`.
|
|
|
|
| |
Parse diff files into a `git_diff` structure.
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
When formatting a patch as email we do not include the commit's
message in the formatted patch output. Implement this and add a
test that verifies behavior.
|
| |
|
| |
|
|
|
|
|
| |
Now that non-pathspec matching diffs are implemented at the iterator
level, drop `FILELIST_MATCH`ing.
|
|
|
|
|
|
| |
Document that `GIT_DIFF_PATHSPEC_DISABLE` is not necessarily about
explicit path matching, but also includes matching of directory
names. Enforce this in a test.
|
| |
|
| |
|
|
|
|
|
| |
Fallback describes the mechanism, while unspecified explains what the
user is thinking.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This lets us specify in the status call which ignore rules we want to
use (optionally falling back to whatever the submodule has in its
configuration).
This removes one of the reasons for having `_set_ignore()` set the value
in-memory. We re-use the `IGNORE_RESET` value for this as it is no
longer relevant but has a similar purpose to `IGNORE_FALLBACK`.
Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of
initializers and move that to fall back to the configuration as well.
|
|
|
|
|
|
|
| |
Introduce a new binary diff callback to provide the actual binary
delta contents to callers. Create this data from the diff contents
(instead of directly from the ODB) to support binary diffs including
the workdir, not just things coming out of the ODB.
|
|
|
|
|
|
|
|
|
|
| |
Mark the `old_file` and `new_file` sides of a delta with a new bit,
`GIT_DIFF_FLAG_EXISTS`, that introduces that a particular side of
the delta exists in the diff.
This is useful for indicating whether a working directory item exists
or not, in the presence of a conflict. Diff users may have previously
used DELETED to determine this information.
|
|
|
|
|
|
|
|
|
|
|
| |
When diffing against an index, return a new `GIT_DELTA_CONFLICTED`
delta type for items that are conflicted. For a single file path,
only one delta will be produced (despite the fact that there are
multiple entries in the index).
Index iterators now have the (optional) ability to return conflicts
in the index. Prior to this change, they would be omitted, and callers
(like diff) would omit conflicted index entries entirely.
|
|
|
|
|
|
|
| |
When checking out with a case-insensitive working directory, we
want to change the case of items in the working directory to
reflect changes that occured in the checkout target. Diff now
has an option to break case-changing renames into delete/add.
|
| |
|
|
|
|
| |
s_xdemitconf
|
| |
|