diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2018-07-01 13:42:53 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-11-05 15:53:33 +0000 |
| commit | 5b8d5a22e702e4862ebfc56e37d18ca11bfebf02 (patch) | |
| tree | 5cce9ba92dbed70e6506a040f07d79cb0208a420 /src/reader.h | |
| parent | 4ff829e96deadcd0d0a11c5d0f3e989cace0056a (diff) | |
| download | libgit2-5b8d5a22e702e4862ebfc56e37d18ca11bfebf02.tar.gz | |
apply: use preimage as the checkout baseline
Use the preimage as the checkout's baseline. This allows us to support
applying patches to files that are modified in the working directory
(those that differ from the HEAD and index). Without this, files will
be reported as (checkout) conflicts. With this, we expect the on-disk
data when we began the patch application (the "preimage") to be on-disk
during checkout.
We could have also simply used the `FORCE` flag to checkout to
accomplish a similar mechanism. However, `FORCE` ignores all
differences, while providing a preimage ensures that we will only
overwrite the file contents that we actually read.
Modify the reader interface to provide the OID to support this.
Diffstat (limited to 'src/reader.h')
| -rw-r--r-- | src/reader.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/reader.h b/src/reader.h index 18c7f59ee..7bb60e144 100644 --- a/src/reader.h +++ b/src/reader.h @@ -22,7 +22,7 @@ typedef struct git_reader git_reader; * reader after disposing the underlying object that it reads. */ struct git_reader { - int (*read)(git_buf *out, git_reader *reader, const char *filename); + int (*read)(git_buf *out, git_oid *out_oid, git_reader *reader, const char *filename); void (*free)(git_reader *reader); }; @@ -89,6 +89,7 @@ extern int git_reader_for_workdir( */ extern int git_reader_read( git_buf *out, + git_oid *out_id, git_reader *reader, const char *filename); |
