Commit Graph

7 Commits

Author SHA1 Message Date
Patrick Steinhardt
ace3508f4c patch_generate: fix git_diff_foreach only working with generated diffs
The current logic of `git_diff_foreach` makes the assumption that all
diffs passed in are actually derived from generated diffs. With these
assumptions we try to derive the actual diff by inspecting either the
working directory files or blobs of a repository. This obviously cannot
work for diffs parsed from a file, where we do not necessarily have a
repository at hand.

Since the introduced split of parsed and generated patches, there are
multiple functions which help us to handle patches generically, being
indifferent from where they stem from. Use these functions and remove
the old logic specific to generated patches. This allows re-using the
same code for invoking the callbacks on the deltas.
2017-03-14 13:08:28 +01:00
Edward Thomson
b859faa61c 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.
2016-08-24 09:08:57 -05:00
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
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
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