diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-06-23 16:27:33 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-06-23 19:15:16 -0400 |
commit | 9017711143ed106ec75df8fc007e383b0c90e18e (patch) | |
tree | 06106f8927a377d38940a0485002cc069295a2c4 /src/diff.h | |
parent | 14304b0e87e92291a1265d5e692bd2d21ba59a62 (diff) | |
download | libgit2-9017711143ed106ec75df8fc007e383b0c90e18e.tar.gz |
stash: save the workdir file when deleted in index
When stashing the workdir tree, examine the index as well. Using
a mechanism similar to `git_diff_tree_to_workdir_with_index`
allows us to determine that a file was added in the index and
subsequently modified in the working directory. Without examining
the index, we would erroneously believe that this file was
untracked and fail to include it in the working directory tree.
Use a slightly modified `git_diff_tree_to_workdir_with_index` in
order to avoid some of the behavior custom to `git diff`. In
particular, be sure to include the working directory side of a
file when it was deleted in the index.
Diffstat (limited to 'src/diff.h')
-rw-r--r-- | src/diff.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/diff.h b/src/diff.h index 39d15fa6d..a202a086c 100644 --- a/src/diff.h +++ b/src/diff.h @@ -133,6 +133,15 @@ typedef git_diff_delta *(*git_diff__merge_cb)( extern int git_diff__merge( git_diff *onto, const git_diff *from, git_diff__merge_cb cb); +extern git_diff_delta *git_diff__merge_like_cgit( + const git_diff_delta *a, + const git_diff_delta *b, + git_pool *pool); + +/* Duplicate a `git_diff_delta` out of the `git_pool` */ +extern git_diff_delta *git_diff__delta_dup( + const git_diff_delta *d, git_pool *pool); + /* * Sometimes a git_diff_file will have a zero size; this attempts to * fill in the size without loading the blob if possible. If that is |