diff options
author | Brandon Williams <bmwill@google.com> | 2017-06-12 15:13:56 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-13 11:40:51 -0700 |
commit | a33e0b2a77d7010ba8bf0e025fffaf98f464a938 (patch) | |
tree | 8a29e638dabfd58be446888daa618d24014d0ca5 | |
parent | 82b474e025e89cfa294e81611c81355a73dc23a2 (diff) | |
download | git-a33e0b2a77d7010ba8bf0e025fffaf98f464a938.tar.gz |
convert: convert renormalize_buffer to take an index
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | convert.c | 6 | ||||
-rw-r--r-- | convert.h | 3 | ||||
-rw-r--r-- | ll-merge.c | 2 | ||||
-rw-r--r-- | merge-recursive.c | 4 |
4 files changed, 9 insertions, 6 deletions
@@ -1,3 +1,4 @@ +#define NO_THE_INDEX_COMPATIBILITY_MACROS #include "cache.h" #include "attr.h" #include "run-command.h" @@ -1165,14 +1166,15 @@ int convert_to_working_tree(const char *path, const char *src, size_t len, struc return convert_to_working_tree_internal(path, src, len, dst, 0); } -int renormalize_buffer(const char *path, const char *src, size_t len, struct strbuf *dst) +int renormalize_buffer(const struct index_state *istate, const char *path, + const char *src, size_t len, struct strbuf *dst) { int ret = convert_to_working_tree_internal(path, src, len, dst, 1); if (ret) { src = dst->buf; len = dst->len; } - return ret | convert_to_git(&the_index, path, src, len, dst, SAFE_CRLF_RENORMALIZE); + return ret | convert_to_git(istate, path, src, len, dst, SAFE_CRLF_RENORMALIZE); } /***************************************************************** @@ -46,7 +46,8 @@ extern int convert_to_git(const struct index_state *istate, struct strbuf *dst, enum safe_crlf checksafe); extern int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst); -extern int renormalize_buffer(const char *path, const char *src, size_t len, +extern int renormalize_buffer(const struct index_state *istate, + const char *path, const char *src, size_t len, struct strbuf *dst); static inline int would_convert_to_git(const struct index_state *istate, const char *path) diff --git a/ll-merge.c b/ll-merge.c index ac0d4a5d78..d7eafb61a6 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -339,7 +339,7 @@ static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr static void normalize_file(mmfile_t *mm, const char *path) { struct strbuf strbuf = STRBUF_INIT; - if (renormalize_buffer(path, mm->ptr, mm->size, &strbuf)) { + if (renormalize_buffer(&the_index, path, mm->ptr, mm->size, &strbuf)) { free(mm->ptr); mm->size = strbuf.len; mm->ptr = strbuf_detach(&strbuf, NULL); diff --git a/merge-recursive.c b/merge-recursive.c index ae5238d82c..eac12d4888 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1639,8 +1639,8 @@ static int blob_unchanged(struct merge_options *opt, * performed. Comparison can be skipped if both files are * unchanged since their sha1s have already been compared. */ - if (renormalize_buffer(path, o.buf, o.len, &o) | - renormalize_buffer(path, a.buf, a.len, &a)) + if (renormalize_buffer(&the_index, path, o.buf, o.len, &o) | + renormalize_buffer(&the_index, path, a.buf, a.len, &a)) ret = (o.len == a.len && !memcmp(o.buf, a.buf, o.len)); error_return: |