FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

diff: document `git_diff_from_buffer` by ethomson · Pull Request #3888 · libgit2/libgit2 · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .h  (1) .md  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
3 changes: 3 additions & 0 deletions CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ v0.24 + 1
`git_repository_open_ext` with this flag will error out if either
`$GIT_WORK_TREE` or `$GIT_COMMON_DIR` is set.

* `git_diff_from_buffer` can create a `git_diff` object from the contents
of a git-style patch file.

### API removals

* `git_blob_create_fromchunks()` has been removed in favour of
Expand Down
19 changes: 19 additions & 0 deletions include/git2/diff.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,25 @@ GIT_EXTERN(int) git_diff_buffers(
git_diff_line_cb line_cb,
void *payload);

/**
* Read the contents of a git patch file into a `git_diff` object.
*
* The diff object produced is similar to the one that would be
* produced if you actually produced it computationally by comparing
* two trees, however there may be subtle differences. For example,
* a patch file likely contains abbreviated object IDs, so the
* object IDs in a `git_diff_delta` produced by this function will
* also be abbreviated.
*
* This function will only read patch files created by a git
* implementation, it will not read unified diffs produced by
* the `diff` program, nor any other types of patch files.
*
* @param out A pointer to a git_diff pointer that will be allocated.
* @param content The contents of a patch file
* @param content_len The length of the patch file contents
* @return 0 or an error code
*/
GIT_EXTERN(int) git_diff_from_buffer(
git_diff **out,
const char *content,
Expand Down

Back | FazBrowse Home | New Git URL